mirror of
https://github.com/CarmJos/EasyPlugin.git
synced 2026-06-05 00:58:17 +08:00
Compare commits
23 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 572c22d2fc | |||
| e416363751 | |||
| 123e5463ad | |||
| 65bc24d1e9 | |||
| 778235e8d1 | |||
| 120362f221 | |||
| 4c10a9798f | |||
| 558723ea82 | |||
| b6bd4beda0 | |||
| 7a06b39b31 | |||
| 29fe7c3f76 | |||
| 01b27e25bb | |||
| 7e35f49e54 | |||
| 4dbcdfb02c | |||
| 9448c21810 | |||
| e30f7ce795 | |||
| 1a9024ca40 | |||
| 0005ce13b4 | |||
| c7190274d7 | |||
| be798a981a | |||
| bbdfe313d5 | |||
| 2acc81185a | |||
| 5886f162af |
@@ -0,0 +1,27 @@
|
||||
# EasyPlugin Repository
|
||||
|
||||
采用github的repo分支进行依赖,随项目发布而自动更新。
|
||||
|
||||
其他依赖方式见主页介绍。
|
||||
|
||||
## 依赖方式
|
||||
|
||||
### Maven
|
||||
|
||||
```xml
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>EasyPlugin</id>
|
||||
<name>GitHub Branch Repository</name>
|
||||
<url>https://github.com/CarmJos/EasyPlugin/blob/repo/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
```
|
||||
|
||||
### Gradle
|
||||
|
||||
```groovy
|
||||
repositories {
|
||||
maven { url 'https://github.com/CarmJos/EasyPlugin/blob/repo/' }
|
||||
}
|
||||
```
|
||||
@@ -14,6 +14,7 @@ assignees: ''
|
||||
### **问题来源**
|
||||
|
||||
描述一下通过哪些操作才发现的问题,如:
|
||||
|
||||
1. 使用了 ...
|
||||
2. 输入了 ...
|
||||
3. 出现了报错 ...
|
||||
@@ -32,7 +33,6 @@ assignees: ''
|
||||
- Java版本: `JDK11` / `OPENJDK8` / `JRE8` / `...`
|
||||
- 服务端版本: 请在后台输入 `version` 并复制相关输出。
|
||||
|
||||
|
||||
### **其他补充**
|
||||
|
||||
如有其他补充,可以在这里描述。
|
||||
|
||||
@@ -8,13 +8,17 @@ assignees: ''
|
||||
---
|
||||
|
||||
### **功能简述**
|
||||
|
||||
简单的描述一下你想要的功能
|
||||
|
||||
### **需求来源**
|
||||
|
||||
简单的描述一下为什么需要这个功能。
|
||||
|
||||
### **功能参考**(可选)
|
||||
|
||||
如果有相关功能的参考,如文本、截图,请提供给我们。
|
||||
|
||||
### **附加内容**
|
||||
|
||||
如果有什么小细节需要重点注意,请在这里告诉我们。
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
|
||||
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
|
||||
|
||||
name: Project Deployment
|
||||
name: Deploy & Publish
|
||||
|
||||
on:
|
||||
# 支持手动触发构建
|
||||
@@ -11,10 +11,8 @@ on:
|
||||
types: [ published ]
|
||||
|
||||
jobs:
|
||||
maven-deploy:
|
||||
|
||||
packages-deploy:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: "Set up JDK"
|
||||
@@ -28,16 +26,14 @@ jobs:
|
||||
server-password: MAVEN_TOKEN
|
||||
|
||||
- name: "Maven Deploy"
|
||||
run: mvn -B deploy --file pom.xml -DskipTests
|
||||
run: mvn -B -Pgithub deploy --file pom.xml -DskipTests
|
||||
env:
|
||||
MAVEN_USERNAME: ${{ github.repository_owner }}
|
||||
MAVEN_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
||||
|
||||
|
||||
javadoc-deploy:
|
||||
|
||||
github-deploy:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: "Set up JDK"
|
||||
@@ -47,6 +43,16 @@ jobs:
|
||||
distribution: 'adopt'
|
||||
cache: maven
|
||||
|
||||
- name: "Maven Deploy"
|
||||
run: mvn -B -Plocal deploy --file pom.xml -DskipTests
|
||||
|
||||
- name: "Copy artifacts"
|
||||
run: |
|
||||
rm -rf deploy
|
||||
mkdir -vp deploy
|
||||
cp -vrf $HOME/local-deploy/* deploy/
|
||||
cp -vrf .documentation/repository/REPO-README.md deploy/README.md
|
||||
|
||||
- name: "Generate Javadoc"
|
||||
run: mvn -B javadoc:aggregate --file pom.xml -DskipTests
|
||||
|
||||
@@ -57,21 +63,21 @@ jobs:
|
||||
cp -vrf target/site/apidocs/* docs/
|
||||
cp -vrf .documentation/javadoc/JAVADOC-README.md docs/README.md
|
||||
|
||||
- name: "Generate Sitemap"
|
||||
- name: "Generate Javadoc sitemap"
|
||||
id: sitemap
|
||||
uses: cicirello/generate-sitemap@v1
|
||||
with:
|
||||
base-url-path: https://carmjos.github.io/EasyPlugin
|
||||
base-url-path: https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}
|
||||
path-to-root: docs
|
||||
|
||||
- name: Output stats
|
||||
- name: "Output Javadoc stats"
|
||||
run: |
|
||||
echo "sitemap-path = ${{ steps.sitemap.outputs.sitemap-path }}"
|
||||
echo "url-count = ${{ steps.sitemap.outputs.url-count }}"
|
||||
echo "excluded-count = ${{ steps.sitemap.outputs.excluded-count }}"
|
||||
ls -l docs
|
||||
|
||||
- name: Configure Git
|
||||
- name: "Configure Git"
|
||||
env:
|
||||
DEPLOY_PRI: ${{secrets.DEPLOY_PRI}}
|
||||
run: |
|
||||
@@ -80,19 +86,25 @@ jobs:
|
||||
echo "$DEPLOY_PRI" > ~/.ssh/id_rsa
|
||||
chmod 600 ~/.ssh/id_rsa
|
||||
ssh-keyscan github.com >> ~/.ssh/known_hosts
|
||||
git config --global user.name 'CarmJos'
|
||||
git config --global user.email 'carm@carm.cc'
|
||||
git config --global user.name '${{ github.repository_owner }}'
|
||||
git config --global user.email '${{ github.repository_owner }}@users.noreply.github.com'
|
||||
|
||||
- name: Commit documentation changes
|
||||
- name: "Commit&Push repository files"
|
||||
run: |
|
||||
cd deploy
|
||||
git init
|
||||
git remote add origin git@github.com:${{ github.repository_owner }}/${{ github.event.repository.name }}.git
|
||||
git checkout -b repo
|
||||
git add -A
|
||||
git commit -m "Maven project deployment."
|
||||
git push origin HEAD:repo --force
|
||||
|
||||
- name: "Commit&Push API documentation"
|
||||
run: |
|
||||
cd docs
|
||||
git init
|
||||
git remote add origin git@github.com:CarmJos/EasyPlugin.git
|
||||
git remote add origin git@github.com:${{ github.repository_owner }}/${{ github.event.repository.name }}.git
|
||||
git checkout -b gh-pages
|
||||
git add -A
|
||||
git commit -m "API Document generated."
|
||||
|
||||
- name: Javadoc Website Push
|
||||
run: |
|
||||
cd docs
|
||||
git push origin HEAD:gh-pages --force
|
||||
@@ -1,7 +1,7 @@
|
||||
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
|
||||
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
|
||||
|
||||
name: Project Build & Tests
|
||||
name: Build & Tests
|
||||
|
||||
on:
|
||||
# 支持手动触发构建
|
||||
@@ -19,7 +19,7 @@ jobs:
|
||||
uses: actions/setup-java@v2
|
||||
with:
|
||||
cache: maven
|
||||
java-version: '11'
|
||||
java-version: '8'
|
||||
distribution: 'adopt'
|
||||
server-id: github
|
||||
server-username: MAVEN_USERNAME
|
||||
|
||||
@@ -67,10 +67,10 @@
|
||||
<repositories>
|
||||
|
||||
<repository>
|
||||
<!--采用github依赖库,安全稳定,但需要配置 (推荐)-->
|
||||
<!--采用github-repo依赖库(推荐)-->
|
||||
<id>EasyPlugin</id>
|
||||
<name>GitHub Packages</name>
|
||||
<url>https://maven.pkg.github.com/CarmJos/EasyPlugin</url>
|
||||
<url>https://raw.githubusercontent.com/CarmJos/EasyPlugin/repo/</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
@@ -121,7 +121,7 @@
|
||||
```groovy
|
||||
repositories {
|
||||
// 采用github依赖库,安全稳定,但需要配置 (推荐)
|
||||
maven { url 'https://maven.pkg.github.com/CarmJos/EasyPlugin' }
|
||||
maven { url 'https://raw.githubusercontent.com/CarmJos/EasyPlugin/repo/' }
|
||||
|
||||
// 采用我的私人依赖库,简单方便,但可能因为变故而无法使用
|
||||
maven { url 'https://repo.carm.cc/repository/maven-public/' }
|
||||
|
||||
+37
-6
@@ -5,16 +5,47 @@
|
||||
<parent>
|
||||
<artifactId>easyplugin-parent</artifactId>
|
||||
<groupId>cc.carm.lib</groupId>
|
||||
<version>1.4.1</version>
|
||||
<version>1.4.8</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>easyplugin-command</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<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-command</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>EasyPlugin-Command</name>
|
||||
<description>轻松插件指令接口模块,方便快捷的编写子指令。</description>
|
||||
<url>https://github.com/CarmJos/EasyPlugin</url>
|
||||
|
||||
<developers>
|
||||
<developer>
|
||||
<id>CarmJos</id>
|
||||
<name>Carm Jos</name>
|
||||
<email>carm@carm.cc</email>
|
||||
<url>https://www.carm.cc</url>
|
||||
</developer>
|
||||
</developers>
|
||||
|
||||
<licenses>
|
||||
<license>
|
||||
<name>The MIT License</name>
|
||||
<url>https://opensource.org/licenses/MIT</url>
|
||||
</license>
|
||||
</licenses>
|
||||
|
||||
<issueManagement>
|
||||
<system>GitHub Issues</system>
|
||||
<url>https://github.com/CarmJos/EasyPlugin/issues</url>
|
||||
</issueManagement>
|
||||
|
||||
<ciManagement>
|
||||
<system>GitHub Actions</system>
|
||||
<url>https://github.com/CarmJos/EasyPlugin/actions/workflows/maven.yml</url>
|
||||
</ciManagement>
|
||||
|
||||
</project>
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package cc.carm.lib.easyplugin.command;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
@@ -7,6 +6,7 @@ import org.bukkit.command.TabExecutor;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.util.StringUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -15,17 +15,25 @@ public abstract class CommandHandler implements TabExecutor, NamedExecutor {
|
||||
|
||||
protected final @NotNull JavaPlugin plugin;
|
||||
protected final @NotNull String cmd;
|
||||
protected final @NotNull List<String> aliases;
|
||||
|
||||
protected final @NotNull Map<String, SubCommand> registeredCommands = new HashMap<>();
|
||||
protected final @NotNull Map<String, CommandHandler> registeredHandlers = new HashMap<>();
|
||||
|
||||
protected final @NotNull Map<String, String> aliasesMap = new HashMap<>();
|
||||
|
||||
public CommandHandler(@NotNull JavaPlugin plugin) {
|
||||
this(plugin, plugin.getName());
|
||||
}
|
||||
|
||||
public CommandHandler(@NotNull JavaPlugin plugin, @NotNull String cmd) {
|
||||
this(plugin, cmd, new String[0]);
|
||||
}
|
||||
|
||||
public CommandHandler(@NotNull JavaPlugin plugin, @NotNull String cmd, @NotNull String... aliases) {
|
||||
this.plugin = plugin;
|
||||
this.cmd = cmd;
|
||||
this.aliases = Arrays.asList(aliases);
|
||||
}
|
||||
|
||||
public abstract void noArgs(CommandSender sender);
|
||||
@@ -34,27 +42,26 @@ public abstract class CommandHandler implements TabExecutor, NamedExecutor {
|
||||
|
||||
public abstract void noPermission(CommandSender sender);
|
||||
|
||||
@Override
|
||||
public @NotNull List<String> getAliases() {
|
||||
return aliases;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.cmd;
|
||||
}
|
||||
|
||||
public void registerSubCommand(SubCommand command) {
|
||||
for (String alias : command.getAliases()) {
|
||||
if (this.registeredCommands.containsKey(alias)) {
|
||||
this.plugin.getLogger().warning("Conflicting command aliases '" + alias + "' for '" + command.getName() + "', overwriting.");
|
||||
}
|
||||
this.registeredCommands.put(alias, command);
|
||||
}
|
||||
String name = command.getName().toLowerCase();
|
||||
this.registeredCommands.put(name, command);
|
||||
command.getAliases().forEach(alias -> this.aliasesMap.put(alias.toLowerCase(), name));
|
||||
}
|
||||
|
||||
public void registerHandler(CommandHandler handler) {
|
||||
for (String alias : handler.getAliases()) {
|
||||
if (this.registeredCommands.containsKey(alias)) {
|
||||
this.plugin.getLogger().warning("Conflicting command aliases '" + alias + "' for '" + handler.getName() + "', overwriting.");
|
||||
}
|
||||
this.registeredHandlers.put(alias, handler);
|
||||
}
|
||||
String name = handler.getName().toLowerCase();
|
||||
this.registeredHandlers.put(name, handler);
|
||||
handler.getAliases().forEach(alias -> this.aliasesMap.put(alias.toLowerCase(), name));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -62,16 +69,18 @@ public abstract class CommandHandler implements TabExecutor, NamedExecutor {
|
||||
if (args.length == 0) {
|
||||
this.noArgs(sender);
|
||||
} else {
|
||||
String sub = args[0].toLowerCase();
|
||||
CommandHandler handler = this.registeredHandlers.get(sub);
|
||||
String input = args[0].toLowerCase();
|
||||
|
||||
CommandHandler handler = getHandler(input);
|
||||
if (handler != null) {
|
||||
if (!handler.hasPermission(sender)) {
|
||||
this.noPermission(sender);
|
||||
} else {
|
||||
handler.onCommand(sender, command, label, this.shortenArgs(args));
|
||||
}
|
||||
} else {
|
||||
SubCommand subCommand = this.registeredCommands.get(sub);
|
||||
}
|
||||
|
||||
SubCommand subCommand = getSubCommand(input);
|
||||
if (subCommand == null) {
|
||||
this.unknownCommand(sender, args);
|
||||
} else if (!subCommand.hasPermission(sender)) {
|
||||
@@ -83,7 +92,7 @@ public abstract class CommandHandler implements TabExecutor, NamedExecutor {
|
||||
this.unknownCommand(sender, args);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -101,12 +110,12 @@ public abstract class CommandHandler implements TabExecutor, NamedExecutor {
|
||||
.collect(Collectors.toList());
|
||||
} else {
|
||||
|
||||
CommandHandler handler = this.registeredHandlers.get(input);
|
||||
CommandHandler handler = getHandler(input);
|
||||
if (handler != null && handler.hasPermission(sender)) {
|
||||
return handler.onTabComplete(sender, command, alias, this.shortenArgs(args));
|
||||
}
|
||||
|
||||
SubCommand subCommand = this.registeredCommands.get(input);
|
||||
SubCommand subCommand = getSubCommand(input);
|
||||
if (subCommand != null && subCommand.hasPermission(sender)) {
|
||||
return subCommand.tabComplete(this.plugin, sender, this.shortenArgs(args));
|
||||
}
|
||||
@@ -124,6 +133,24 @@ public abstract class CommandHandler implements TabExecutor, NamedExecutor {
|
||||
return sortedExecutors;
|
||||
}
|
||||
|
||||
protected @Nullable CommandHandler getHandler(@NotNull String name) {
|
||||
CommandHandler fromName = this.registeredHandlers.get(name);
|
||||
if (fromName != null) return fromName;
|
||||
|
||||
String nameFromAlias = this.aliasesMap.get(name);
|
||||
if (nameFromAlias == null) return null;
|
||||
else return this.registeredHandlers.get(nameFromAlias);
|
||||
}
|
||||
|
||||
protected @Nullable SubCommand getSubCommand(@NotNull String name) {
|
||||
SubCommand fromName = this.registeredCommands.get(name);
|
||||
if (fromName != null) return fromName;
|
||||
|
||||
String nameFromAlias = this.aliasesMap.get(name);
|
||||
if (nameFromAlias == null) return null;
|
||||
else return this.registeredCommands.get(nameFromAlias);
|
||||
}
|
||||
|
||||
protected String[] shortenArgs(String[] args) {
|
||||
if (args.length == 0) {
|
||||
return args;
|
||||
|
||||
@@ -1,20 +1,36 @@
|
||||
package cc.carm.lib.easyplugin.command;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.permissions.Permissible;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Function;
|
||||
|
||||
public interface NamedExecutor {
|
||||
|
||||
String getName();
|
||||
|
||||
default List<String> getAliases() {
|
||||
return Collections.singletonList(getName());
|
||||
}
|
||||
List<String> getAliases();
|
||||
|
||||
default boolean hasPermission(Permissible permissible) {
|
||||
return true;
|
||||
}
|
||||
|
||||
default Void sendMessage(@NotNull CommandSender sender, @NotNull String... messages) {
|
||||
return sendMessage(sender, (Function<String, String>) null, messages);
|
||||
}
|
||||
|
||||
default Void sendMessage(@NotNull CommandSender sender,
|
||||
@Nullable Function<String, String> parser,
|
||||
@NotNull String... messages) {
|
||||
if (messages == null || messages.length == 0) return null;
|
||||
Function<String, String> finalParser = Optional.ofNullable(parser).orElse(Function.identity());
|
||||
Arrays.stream(messages).map(finalParser).forEach(sender::sendMessage);
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class SimpleCompleter {
|
||||
|
||||
@@ -21,9 +22,13 @@ public class SimpleCompleter {
|
||||
}
|
||||
|
||||
public static @NotNull List<String> objects(@NotNull String input, int limit, List<?> objects) {
|
||||
return objects.stream().filter(Objects::nonNull).map(Object::toString)
|
||||
return objects(input, limit, objects.stream());
|
||||
}
|
||||
|
||||
public static @NotNull List<String> objects(@NotNull String input, int limit, Stream<?> stream) {
|
||||
return stream.filter(Objects::nonNull).map(Object::toString)
|
||||
.filter(s -> StringUtil.startsWithIgnoreCase(s, input))
|
||||
.limit(Math.min(0, limit)).collect(Collectors.toList());
|
||||
.limit(Math.max(0, limit)).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public static @NotNull List<String> text(@NotNull String input, String... texts) {
|
||||
@@ -47,7 +52,7 @@ public class SimpleCompleter {
|
||||
}
|
||||
|
||||
public static @NotNull List<String> onlinePlayers(@NotNull String input, int limit) {
|
||||
return text(input, limit, Bukkit.getOnlinePlayers().stream().map(HumanEntity::getName).collect(Collectors.toList()));
|
||||
return objects(input, limit, Bukkit.getOnlinePlayers().stream().map(HumanEntity::getName));
|
||||
}
|
||||
|
||||
public static @NotNull List<String> allPlayers(@NotNull String input) {
|
||||
@@ -55,7 +60,7 @@ public class SimpleCompleter {
|
||||
}
|
||||
|
||||
public static @NotNull List<String> allPlayers(@NotNull String input, int limit) {
|
||||
return text(input, limit, Arrays.stream(Bukkit.getOfflinePlayers()).map(OfflinePlayer::getName).collect(Collectors.toList()));
|
||||
return objects(input, limit, Arrays.stream(Bukkit.getOfflinePlayers()).map(OfflinePlayer::getName));
|
||||
}
|
||||
|
||||
public static @NotNull List<String> worlds(@NotNull String input) {
|
||||
@@ -63,7 +68,7 @@ public class SimpleCompleter {
|
||||
}
|
||||
|
||||
public static @NotNull List<String> worlds(@NotNull String input, int limit) {
|
||||
return text(input, limit, Bukkit.getWorlds().stream().map(World::getName).collect(Collectors.toList()));
|
||||
return objects(input, limit, Bukkit.getWorlds().stream().map(World::getName));
|
||||
}
|
||||
|
||||
public static @NotNull List<String> materials(@NotNull String input) {
|
||||
@@ -71,7 +76,7 @@ public class SimpleCompleter {
|
||||
}
|
||||
|
||||
public static @NotNull List<String> materials(@NotNull String input, int limit) {
|
||||
return text(input, limit, Arrays.stream(Material.values()).map(Enum::name).collect(Collectors.toList()));
|
||||
return objects(input, limit, Arrays.stream(Material.values()).map(Enum::name));
|
||||
}
|
||||
|
||||
public static @NotNull List<String> effects(@NotNull String input) {
|
||||
@@ -79,7 +84,7 @@ public class SimpleCompleter {
|
||||
}
|
||||
|
||||
public static @NotNull List<String> effects(@NotNull String input, int limit) {
|
||||
return text(input, limit, Arrays.stream(PotionEffectType.values()).map(PotionEffectType::getName).collect(Collectors.toList()));
|
||||
return objects(input, limit, Arrays.stream(PotionEffectType.values()).map(PotionEffectType::getName));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,15 +3,34 @@ package cc.carm.lib.easyplugin.command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@SuppressWarnings("UnusedReturnValue")
|
||||
public abstract class SubCommand implements NamedExecutor {
|
||||
|
||||
private final String name;
|
||||
private final List<String> aliases;
|
||||
|
||||
public SubCommand(String name) {
|
||||
this(name, new String[0]);
|
||||
}
|
||||
|
||||
public SubCommand(String name, String... aliases) {
|
||||
this.name = name;
|
||||
this.aliases = Arrays.asList(aliases);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getAliases() {
|
||||
return this.aliases;
|
||||
}
|
||||
|
||||
public abstract Void execute(JavaPlugin plugin, CommandSender sender, String[] args);
|
||||
@@ -20,9 +39,5 @@ public abstract class SubCommand implements NamedExecutor {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+1
-25
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>easyplugin-parent</artifactId>
|
||||
<groupId>cc.carm.lib</groupId>
|
||||
<version>1.4.1</version>
|
||||
<version>1.4.8</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
@@ -59,28 +59,4 @@
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -156,14 +156,16 @@ public class GUI {
|
||||
}
|
||||
|
||||
public void openGUI(Player player) {
|
||||
if (this.type == GUIType.CANCEL) { throw new IllegalStateException("被取消或不存在的GUI"); }
|
||||
if (this.type == GUIType.CANCEL) {
|
||||
throw new IllegalStateException("被取消或不存在的GUI");
|
||||
}
|
||||
|
||||
Inventory inv = Bukkit.createInventory(null, this.type.getSize(), this.name);
|
||||
IntStream.range(0, inv.getSize()).forEach(index -> inv.setItem(index, new ItemStack(Material.AIR)));
|
||||
getItems().forEach((index, item) -> inv.setItem(index, item.getDisplay()));
|
||||
|
||||
GUI previous = getOpenedGUI(player);
|
||||
if(previous != null){
|
||||
if (previous != null) {
|
||||
previous.listener.close(player);
|
||||
}
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ public class GUIListener implements Listener {
|
||||
|
||||
}
|
||||
|
||||
protected void close(Player p){
|
||||
protected void close(Player p) {
|
||||
HandlerList.unregisterAll(this);
|
||||
getCurrentGUI().listener = null;
|
||||
GUI.removeOpenedGUI(p);
|
||||
|
||||
+58
-5
@@ -3,18 +3,39 @@ package cc.carm.lib.easyplugin.gui.configuration;
|
||||
import cc.carm.lib.easyplugin.gui.GUIItem;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
import org.jetbrains.annotations.Contract;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class GUIActionConfiguration {
|
||||
|
||||
public static @NotNull GUIActionConfiguration of(@NotNull GUIActionType actionType,
|
||||
@Nullable ClickType clickType,
|
||||
@Nullable String actionContent) {
|
||||
return new GUIActionConfiguration(actionType, clickType, actionContent);
|
||||
}
|
||||
|
||||
@Nullable ClickType clickType;
|
||||
final @NotNull GUIActionType actionType;
|
||||
final @Nullable String actionContent;
|
||||
public static @NotNull GUIActionConfiguration of(@NotNull GUIActionType actionType,
|
||||
@Nullable String actionContent) {
|
||||
return of(actionType, null, actionContent);
|
||||
}
|
||||
|
||||
public GUIActionConfiguration(@Nullable ClickType clickType,
|
||||
@NotNull GUIActionType actionType,
|
||||
public static @NotNull GUIActionConfiguration of(@NotNull GUIActionType actionType,
|
||||
@Nullable ClickType clickType) {
|
||||
return of(actionType, clickType, null);
|
||||
}
|
||||
|
||||
public static @NotNull GUIActionConfiguration of(@NotNull GUIActionType actionType) {
|
||||
return of(actionType, null, null);
|
||||
}
|
||||
|
||||
protected final @NotNull GUIActionType actionType;
|
||||
|
||||
protected final @Nullable ClickType clickType;
|
||||
protected final @Nullable String actionContent;
|
||||
|
||||
public GUIActionConfiguration(@NotNull GUIActionType actionType,
|
||||
@Nullable ClickType clickType,
|
||||
@Nullable String actionContent) {
|
||||
this.clickType = clickType;
|
||||
this.actionType = actionType;
|
||||
@@ -50,4 +71,36 @@ public class GUIActionConfiguration {
|
||||
};
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Contract("null->null")
|
||||
public static GUIActionConfiguration deserialize(@Nullable String actionString) {
|
||||
if (actionString == null) return null;
|
||||
|
||||
int prefixStart = actionString.indexOf("[");
|
||||
int prefixEnd = actionString.indexOf("]");
|
||||
if (prefixStart < 0 || prefixEnd < 0) return null;
|
||||
|
||||
String prefix = actionString.substring(prefixStart + 1, prefixEnd);
|
||||
ClickType clickType = null;
|
||||
GUIActionType actionType;
|
||||
if (prefix.contains(":")) {
|
||||
String[] args = prefix.split(":");
|
||||
clickType = GUIConfiguration.readClickType(args[0]);
|
||||
actionType = GUIActionType.readActionType(args[1]);
|
||||
} else {
|
||||
actionType = GUIActionType.readActionType(prefix);
|
||||
}
|
||||
|
||||
if (actionType == null) return null;
|
||||
|
||||
String content = actionString.substring(prefixEnd + 1).trim();
|
||||
return of(actionType, clickType, content);
|
||||
}
|
||||
|
||||
public @NotNull String serialize() {
|
||||
String prefix = "[" + getActionType().name() + (getClickType() == null ? "" : ":" + getClickType().name()) + "]";
|
||||
String content = getActionContent() == null ? "" : " " + getActionContent();
|
||||
return prefix + content;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+32
-30
@@ -7,30 +7,27 @@ import cc.carm.lib.easyplugin.utils.MessageUtils;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class GUIItemConfiguration {
|
||||
|
||||
Material material;
|
||||
@NotNull Material type;
|
||||
int data;
|
||||
String name;
|
||||
@Nullable String name;
|
||||
@NotNull List<String> lore;
|
||||
|
||||
@NotNull List<Integer> slots;
|
||||
@NotNull List<GUIActionConfiguration> actions;
|
||||
|
||||
public GUIItemConfiguration(Material material, int data,
|
||||
String name, @NotNull List<String> lore,
|
||||
public GUIItemConfiguration(@NotNull Material type, int data,
|
||||
@Nullable String name, @NotNull List<String> lore,
|
||||
@NotNull List<GUIActionConfiguration> actions,
|
||||
@NotNull List<Integer> slots) {
|
||||
this.material = material;
|
||||
this.type = type;
|
||||
this.data = data;
|
||||
this.name = name;
|
||||
this.lore = lore;
|
||||
@@ -39,7 +36,7 @@ public class GUIItemConfiguration {
|
||||
}
|
||||
|
||||
public void setupItems(Player player, GUI gui) {
|
||||
ItemStackFactory icon = new ItemStackFactory(this.material);
|
||||
ItemStackFactory icon = new ItemStackFactory(this.type);
|
||||
icon.setDurability(this.data);
|
||||
if (this.name != null) icon.setDisplayName(this.name);
|
||||
icon.setLore(MessageUtils.setPlaceholders(player, this.lore));
|
||||
@@ -49,10 +46,29 @@ public class GUIItemConfiguration {
|
||||
this.slots.forEach(slot -> gui.setItem(slot, item));
|
||||
}
|
||||
|
||||
public @NotNull Map<String, Object> serialize() {
|
||||
LinkedHashMap<String, Object> map = new LinkedHashMap<>();
|
||||
|
||||
map.put("type", this.type.name());
|
||||
if (this.name != null) map.put("name", this.name);
|
||||
if (this.data != 0) map.put("data", this.data);
|
||||
if (!this.lore.isEmpty()) map.put("lore", this.lore);
|
||||
if (this.slots.size() > 1) {
|
||||
map.put("slots", this.slots);
|
||||
} else if (slots.size() == 1) {
|
||||
map.put("slot", this.slots.get(0));
|
||||
}
|
||||
if (!this.actions.isEmpty()) {
|
||||
map.put("actions", this.actions.stream().map(GUIActionConfiguration::serialize).collect(Collectors.toList()));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static GUIItemConfiguration readFrom(@Nullable ConfigurationSection itemSection) {
|
||||
if (itemSection == null) return null;
|
||||
Material material = Optional.ofNullable(Material.matchMaterial(itemSection.getString("material", "STONE"))).orElse(Material.STONE);
|
||||
String material = Optional.ofNullable(itemSection.getString("type")).orElse("STONE");
|
||||
Material type = Optional.ofNullable(Material.matchMaterial(material)).orElse(Material.STONE);
|
||||
int data = itemSection.getInt("data", 0);
|
||||
String name = itemSection.getString("name");
|
||||
List<String> lore = itemSection.getStringList("lore");
|
||||
@@ -63,27 +79,13 @@ public class GUIItemConfiguration {
|
||||
List<String> actionsString = itemSection.getStringList("actions");
|
||||
List<GUIActionConfiguration> actions = new ArrayList<>();
|
||||
for (String actionString : actionsString) {
|
||||
int prefixStart = actionString.indexOf("[");
|
||||
int prefixEnd = actionString.indexOf("]");
|
||||
if (prefixStart < 0 || prefixEnd < 0) continue;
|
||||
|
||||
String prefix = actionString.substring(prefixStart + 1, prefixEnd);
|
||||
ClickType clickType = null;
|
||||
GUIActionType actionType;
|
||||
if (prefix.contains(":")) {
|
||||
String[] args = prefix.split(":");
|
||||
clickType = GUIConfiguration.readClickType(args[0]);
|
||||
actionType = GUIActionType.readActionType(args[1]);
|
||||
} else {
|
||||
actionType = GUIActionType.readActionType(prefix);
|
||||
}
|
||||
|
||||
if (actionType == null) continue;
|
||||
actions.add(new GUIActionConfiguration(clickType, actionType, actionString.substring(prefixEnd + 1).trim()));
|
||||
GUIActionConfiguration action = GUIActionConfiguration.deserialize(actionString);
|
||||
if (action == null) continue;
|
||||
actions.add(action);
|
||||
}
|
||||
|
||||
return new GUIItemConfiguration(
|
||||
material, data, name, lore, actions,
|
||||
type, data, name, lore, actions,
|
||||
slots.size() > 0 ? slots : Collections.singletonList(slot)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
import cc.carm.lib.easyplugin.gui.configuration.GUIActionType;
|
||||
import cc.carm.lib.easyplugin.gui.configuration.GUIConfiguration;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
|
||||
+1
-23
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>easyplugin-parent</artifactId>
|
||||
<groupId>cc.carm.lib</groupId>
|
||||
<version>1.4.1</version>
|
||||
<version>1.4.8</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
@@ -56,31 +56,9 @@
|
||||
<dependency>
|
||||
<groupId>me.clip</groupId>
|
||||
<artifactId>placeholderapi</artifactId>
|
||||
<version>2.10.9</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
@@ -7,26 +7,41 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.PluginCommand;
|
||||
import org.bukkit.command.TabCompleter;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.plugin.PluginDescriptionFile;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.plugin.java.JavaPluginLoader;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
public abstract class EasyPlugin extends JavaPlugin {
|
||||
|
||||
protected EasyPluginMessageProvider messageProvider;
|
||||
protected @NotNull EasyPluginMessageProvider messageProvider;
|
||||
|
||||
public EasyPlugin() {
|
||||
this(EasyPluginMessageProvider.ZH_CN);
|
||||
}
|
||||
|
||||
public EasyPlugin(EasyPluginMessageProvider messageProvider) {
|
||||
public EasyPlugin(@NotNull EasyPluginMessageProvider messageProvider) {
|
||||
this.messageProvider = messageProvider;
|
||||
}
|
||||
|
||||
protected EasyPlugin(JavaPluginLoader loader, PluginDescriptionFile descriptionFile, File dataFolder, File file) {
|
||||
this(EasyPluginMessageProvider.ZH_CN, loader, descriptionFile, dataFolder, file);
|
||||
}
|
||||
|
||||
protected EasyPlugin(@NotNull EasyPluginMessageProvider messageProvider,
|
||||
JavaPluginLoader loader, PluginDescriptionFile descriptionFile, File dataFolder, File file) {
|
||||
super(loader, descriptionFile, dataFolder, file);
|
||||
this.messageProvider = messageProvider;
|
||||
}
|
||||
|
||||
@@ -134,6 +149,21 @@ public abstract class EasyPlugin extends JavaPlugin {
|
||||
if (isDebugging()) print("&8[DEBUG] &r", messages);
|
||||
}
|
||||
|
||||
public void callEventSync(Event event) {
|
||||
getScheduler().run(() -> Bukkit.getPluginManager().callEvent(event));
|
||||
}
|
||||
|
||||
public void callEventAsync(Event event) {
|
||||
getScheduler().runAsync(() -> Bukkit.getPluginManager().callEvent(event));
|
||||
}
|
||||
|
||||
public @NotNull <T extends Event> CompletableFuture<T> callEventFuture(T event) {
|
||||
return CompletableFuture.supplyAsync(() -> {
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
return event;
|
||||
});
|
||||
}
|
||||
|
||||
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
|
||||
private boolean hasOverride(String methodName) {
|
||||
Map<Method, Method> methodMap = new HashMap<>();
|
||||
|
||||
@@ -8,7 +8,7 @@ import java.util.stream.Collectors;
|
||||
|
||||
public class ColorParser {
|
||||
|
||||
public static final Pattern HEX_PATTERN = Pattern.compile("&\\(&?#([0-9a-fA-F]{6})\\)");
|
||||
public static final Pattern HEX_PATTERN = Pattern.compile("&\\(&?#([\\da-fA-F]{6})\\)");
|
||||
|
||||
public static String parse(String text) {
|
||||
return parseBaseColor(parseHexColor(text));
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
<?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.8</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-storage</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>EasyPlugin-Storage</name>
|
||||
<description>轻松插件存储接口模块,包含存储相关的统一接口。</description>
|
||||
<url>https://github.com/CarmJos/EasyPlugin</url>
|
||||
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,40 @@
|
||||
package cc.carm.lib.easyplugin.storage;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public interface DataStorage<K, T> {
|
||||
|
||||
/**
|
||||
* 在插件加载存储源时执行。
|
||||
*
|
||||
* @throws Exception 当出现任何错误时抛出
|
||||
*/
|
||||
void initialize() throws Exception;
|
||||
|
||||
/**
|
||||
* 在插件被卸载时执行。
|
||||
*/
|
||||
void shutdown();
|
||||
|
||||
/**
|
||||
* 用于加载数据的方法。<b>该方法应当异步运行!</b>
|
||||
* <br>
|
||||
* <br>若不存在对应数据,请返回 null 。
|
||||
* <br>若加载出现任何错误,请抛出异常。
|
||||
*
|
||||
* @param key 数据主键
|
||||
* @throws Exception 当出现任何错误时抛出
|
||||
*/
|
||||
@Nullable
|
||||
T loadData(@NotNull K key) throws Exception;
|
||||
|
||||
/**
|
||||
* 用于保存数据的方法。 <b>该方法应当被异步运行!</b>
|
||||
*
|
||||
* @param data 数据
|
||||
* @throws Exception 当出现任何错误时抛出
|
||||
*/
|
||||
void saveData(@NotNull T data) throws Exception;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package cc.carm.lib.easyplugin.storage;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface StorageType<K, T, S extends DataStorage<K, T>> {
|
||||
|
||||
int getID();
|
||||
|
||||
@NotNull List<String> getAlias();
|
||||
|
||||
@NotNull Class<? extends S> getStorageClass();
|
||||
|
||||
default @NotNull S createStorage() throws Exception {
|
||||
return getStorageClass().newInstance();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package cc.carm.lib.easyplugin.storage.file;
|
||||
|
||||
import cc.carm.lib.easyplugin.storage.DataStorage;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public abstract class FileBasedStorage<K, T> implements DataStorage<K, T> {
|
||||
|
||||
|
||||
protected final String fileName;
|
||||
protected File dataFile;
|
||||
|
||||
public FileBasedStorage(String fileName) {
|
||||
this.fileName = fileName;
|
||||
}
|
||||
|
||||
protected @NotNull File initializeFile(@NotNull File parentFolder) throws Exception {
|
||||
this.dataFile = new File(parentFolder, fileName);
|
||||
if (!dataFile.exists()) {
|
||||
if (!dataFile.createNewFile()) throw new Exception("无法创建数据文件!");
|
||||
} else if (dataFile.isDirectory()) {
|
||||
throw new Exception("文件路径对应的不是一个文件!");
|
||||
}
|
||||
return dataFile;
|
||||
}
|
||||
|
||||
public File getDataFile() {
|
||||
return dataFile;
|
||||
}
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
package cc.carm.lib.easyplugin.storage.file;
|
||||
|
||||
import cc.carm.lib.easyplugin.storage.DataStorage;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class FolderBasedStorage<K, T> implements DataStorage<K, T> {
|
||||
|
||||
protected final @NotNull String folderPath;
|
||||
protected File dataFolder;
|
||||
|
||||
public FolderBasedStorage(@NotNull String folderPath) {
|
||||
this.folderPath = folderPath;
|
||||
}
|
||||
|
||||
protected @NotNull File initializeFolder(@NotNull File parentFolder) throws Exception {
|
||||
this.dataFolder = new File(parentFolder, folderPath);
|
||||
if (!dataFolder.exists()) {
|
||||
if (!dataFolder.mkdir()) {
|
||||
throw new Exception("无法创建数据文件夹!");
|
||||
}
|
||||
} else if (!dataFolder.isDirectory()) {
|
||||
throw new Exception("数据文件夹路径对应的不是一个文件夹!");
|
||||
}
|
||||
return dataFolder;
|
||||
}
|
||||
|
||||
protected @NotNull List<File> listFiles() {
|
||||
if (this.dataFolder == null) return Collections.emptyList();
|
||||
if (!this.dataFolder.isDirectory()) return Collections.emptyList();
|
||||
|
||||
File[] files = this.dataFolder.listFiles();
|
||||
if (files == null) return Collections.emptyList();
|
||||
|
||||
return Arrays.asList(files);
|
||||
}
|
||||
|
||||
public File getDataFolder() {
|
||||
return dataFolder;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package cc.carm.lib.easyplugin.storage.file;
|
||||
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public abstract class YAMLBasedStorage<K, T> extends FileBasedStorage<K, T> {
|
||||
|
||||
protected FileConfiguration configuration;
|
||||
|
||||
public YAMLBasedStorage(String fileName) {
|
||||
super(fileName);
|
||||
}
|
||||
|
||||
protected @NotNull FileConfiguration initializeConfiguration(@NotNull File parentFolder) throws Exception {
|
||||
return this.configuration = YamlConfiguration.loadConfiguration(initializeFile(parentFolder));
|
||||
}
|
||||
|
||||
public FileConfiguration getConfiguration() {
|
||||
return configuration;
|
||||
}
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
package cc.carm.lib.easyplugin.storage.plugin;
|
||||
|
||||
import cc.carm.lib.easyplugin.storage.DataStorage;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
public abstract class PluginBasedStorage<K, T> implements DataStorage<K, T> {
|
||||
|
||||
protected Plugin dependPlugin;
|
||||
|
||||
public PluginBasedStorage(String dependPluginName) {
|
||||
this(Bukkit.getPluginManager().getPlugin(dependPluginName));
|
||||
}
|
||||
|
||||
public PluginBasedStorage(Plugin dependPlugin) {
|
||||
this.dependPlugin = dependPlugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize() throws NullPointerException {
|
||||
if (dependPlugin == null) {
|
||||
throw new NullPointerException("该存储类型依赖的插件不存在,请检查配置文件");
|
||||
}
|
||||
}
|
||||
|
||||
public Plugin getDependPlugin() {
|
||||
return dependPlugin;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>easyplugin-parent</artifactId>
|
||||
<groupId>cc.carm.lib</groupId>
|
||||
<version>1.4.1</version>
|
||||
<version>1.4.8</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
+7
-50
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>easyplugin-parent</artifactId>
|
||||
<groupId>cc.carm.lib</groupId>
|
||||
<version>1.4.1</version>
|
||||
<version>1.4.8</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
@@ -50,39 +50,6 @@
|
||||
<url>https://github.com/CarmJos/EasyPlugin/actions/workflows/maven.yml</url>
|
||||
</ciManagement>
|
||||
|
||||
<distributionManagement>
|
||||
<downloadUrl>https://github.com/CarmJos/EasyPlugin/releases</downloadUrl>
|
||||
<repository>
|
||||
<id>github</id>
|
||||
<name>GitHub Packages</name>
|
||||
<url>https://maven.pkg.github.com/CarmJos/EasyPlugin</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
|
||||
<repositories>
|
||||
|
||||
<repository>
|
||||
<id>carm-repo</id>
|
||||
<name>Carm's Repo</name>
|
||||
<url>https://repo.carm.cc/repository/maven-public/</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>central</id>
|
||||
<url>https://repo1.maven.org/maven2/</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>github</id>
|
||||
<name>GitHub Packages</name>
|
||||
<url>https://maven.pkg.github.com/CarmJos/*</url>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
|
||||
</repositories>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
@@ -90,21 +57,11 @@
|
||||
<artifactId>easyplugin-main</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>${project.parent.groupId}</groupId>
|
||||
<artifactId>easyplugin-configuration</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>${project.parent.groupId}</groupId>
|
||||
<artifactId>easyplugin-command</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-gui</artifactId>
|
||||
@@ -112,7 +69,7 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>${project.parent.groupId}</groupId>
|
||||
<artifactId>easyplugin-placeholderapi</artifactId>
|
||||
<artifactId>easyplugin-papi</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@@ -120,11 +77,6 @@
|
||||
<artifactId>easyplugin-vault</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>${project.parent.groupId}</groupId>
|
||||
<artifactId>easyplugin-lp</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
@@ -139,6 +91,11 @@
|
||||
<artifactId>easyplugin-gui</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>${project.parent.groupId}</groupId>
|
||||
<artifactId>easyplugin-command</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>${project.parent.groupId}</groupId>
|
||||
<artifactId>easyplugin-placeholderapi</artifactId>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>easyplugin-parent</artifactId>
|
||||
<groupId>cc.carm.lib</groupId>
|
||||
<version>1.4.1</version>
|
||||
<version>1.4.8</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
@@ -60,18 +60,10 @@
|
||||
<type>pom</type>
|
||||
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>cc.carm.lib</groupId>
|
||||
<artifactId>easyplugin-github</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>cc.carm.lib</groupId>
|
||||
<artifactId>easyplugin-placeholderapi</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>cc.carm.lib</groupId>
|
||||
<artifactId>easyplugin-lp</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>cc.carm.lib</groupId>
|
||||
<artifactId>easyplugin-vault</artifactId>
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
<?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.8</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-githubchecker</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>EasyPlugin-GithubChecker</name>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>cc.carm.lib</groupId>
|
||||
<artifactId>githubreleases4j</artifactId>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
||||
</project>
|
||||
+84
@@ -0,0 +1,84 @@
|
||||
package cc.carm.lib.easyplugin.updatechecker;
|
||||
|
||||
import cc.carm.lib.githubreleases4j.GithubReleases4J;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class GHUpdateChecker {
|
||||
|
||||
protected static final @NotNull Pattern GH_URL_PATTERN = Pattern.compile("^https?://github.com/([A-Za-z\\d-_]+)/([^/]*?)/?");
|
||||
|
||||
public static @NotNull GHUpdateChecker of(@NotNull Logger logger, @NotNull String owner, @NotNull String repo) {
|
||||
return new GHUpdateChecker(logger, owner, repo);
|
||||
}
|
||||
|
||||
public static @NotNull GHUpdateChecker of(@NotNull Plugin plugin) {
|
||||
return new GHUpdateChecker(plugin.getLogger(), getGithubOwner(plugin), plugin.getName());
|
||||
}
|
||||
|
||||
public static @NotNull Runnable runner(@NotNull Logger logger,
|
||||
@NotNull String owner, @NotNull String repo,
|
||||
@NotNull String currentVersion) {
|
||||
return of(logger, owner, repo).runner(currentVersion);
|
||||
}
|
||||
|
||||
public static @NotNull Runnable runner(@NotNull Plugin plugin) {
|
||||
return of(plugin).runner(plugin.getDescription().getVersion());
|
||||
}
|
||||
|
||||
protected final @NotNull Logger logger;
|
||||
protected final @NotNull String owner;
|
||||
protected final @NotNull String repo;
|
||||
|
||||
public GHUpdateChecker(@NotNull Logger logger, @NotNull String owner, @NotNull String repo) {
|
||||
this.logger = logger;
|
||||
this.owner = owner;
|
||||
this.repo = repo;
|
||||
}
|
||||
|
||||
public void checkUpdate(@NotNull String currentVersion) {
|
||||
Integer behindVersions = GithubReleases4J.getVersionBehind(owner, repo, currentVersion);
|
||||
String downloadURL = GithubReleases4J.getReleasesURL(owner, repo);
|
||||
|
||||
if (behindVersions == null) {
|
||||
this.logger.severe("检查更新失败,请您定期查看插件是否更新,避免安全问题。");
|
||||
this.logger.severe("下载地址 " + downloadURL);
|
||||
} else if (behindVersions == 0) {
|
||||
this.logger.info("检查完成,当前已是最新版本。");
|
||||
} else if (behindVersions > 0) {
|
||||
this.logger.info("发现新版本! 目前已落后 " + behindVersions + " 个版本。");
|
||||
this.logger.info("最新版下载地址 " + downloadURL);
|
||||
} else {
|
||||
this.logger.severe("检查更新失败! 当前版本未知,请您使用原生版本以避免安全问题。");
|
||||
this.logger.severe("最新版下载地址 " + downloadURL);
|
||||
}
|
||||
}
|
||||
|
||||
public Runnable runner(@NotNull String currentVersion) {
|
||||
return () -> checkUpdate(currentVersion);
|
||||
}
|
||||
|
||||
protected static String getGithubOwner(Plugin plugin) {
|
||||
// 首先,尝试从插件提供的网址中获取OWNER
|
||||
String websiteOwner = getGithubOwner(plugin.getDescription().getWebsite());
|
||||
if (websiteOwner != null && !websiteOwner.isEmpty()) return websiteOwner;
|
||||
|
||||
// 如果插件提供的网址中没有,则尝试获取插件的首位作者名
|
||||
List<String> authors = plugin.getDescription().getAuthors();
|
||||
if (!authors.isEmpty()) return authors.get(0);
|
||||
|
||||
// 再没有的话只能返回插件的名称了
|
||||
return plugin.getName();
|
||||
}
|
||||
|
||||
protected static String getGithubOwner(String url) {
|
||||
Matcher matcher = GH_URL_PATTERN.matcher(url);
|
||||
return matcher.find() ? matcher.group(1) : null;
|
||||
}
|
||||
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package cc.carm.lib.easyplugin.updatechecker;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
public class RegexTest {
|
||||
|
||||
|
||||
@Test
|
||||
public void onTest() {
|
||||
System.out.println(GHUpdateChecker.getGithubOwner("https://github.com/CarmJos/EasyPlugin"));
|
||||
System.out.println(GHUpdateChecker.getGithubOwner("https://github.com/Ghost-chu/QuickShop-Hikari/pulls"));
|
||||
System.out.println(GHUpdateChecker.getGithubOwner("https://github.com/QWQ123/QuickShop"));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+11
-1
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>easyplugin-parent</artifactId>
|
||||
<groupId>cc.carm.lib</groupId>
|
||||
<version>1.4.1</version>
|
||||
<version>1.4.8</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
@@ -22,4 +22,14 @@
|
||||
|
||||
<name>EasyPlugin-PlaceholderAPI</name>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>me.clip</groupId>
|
||||
<artifactId>placeholderapi</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>easyplugin-parent</artifactId>
|
||||
<groupId>cc.carm.lib</groupId>
|
||||
<version>1.4.1</version>
|
||||
<version>1.4.8</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
@@ -27,7 +27,6 @@
|
||||
<dependency>
|
||||
<groupId>com.github.MilkBowl</groupId>
|
||||
<artifactId>VaultAPI</artifactId>
|
||||
<version>1.7</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
@@ -15,19 +15,21 @@
|
||||
<groupId>cc.carm.lib</groupId>
|
||||
<artifactId>easyplugin-parent</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>1.4.1</version>
|
||||
<version>1.4.8</version>
|
||||
<modules>
|
||||
|
||||
<module>base/main</module>
|
||||
<module>base/command</module>
|
||||
<module>base/gui</module>
|
||||
|
||||
<module>extension/papi</module>
|
||||
<module>extension/vault</module>
|
||||
<module>extension/gh-checker</module>
|
||||
|
||||
<module>collection/all</module>
|
||||
<module>collection/bom</module>
|
||||
<module>collection/common</module>
|
||||
<module>base/command</module>
|
||||
<module>base/storage</module>
|
||||
|
||||
</modules>
|
||||
|
||||
@@ -35,6 +37,13 @@
|
||||
<description>轻松插件类库,简单快捷的通用Spigot插件基础类库。</description>
|
||||
<url>https://github.com/CarmJos/EasyPlugin</url>
|
||||
|
||||
<scm>
|
||||
<connection>scm:git:git@github.com:CarmJos/EasyPlugin.git</connection>
|
||||
<developerConnection>scm:git:git@github.com:CarmJos/EasyPlugin.git</developerConnection>
|
||||
<url>https://github.com/CarmJos/EasyPlugin</url>
|
||||
<tag>HEAD</tag>
|
||||
</scm>
|
||||
|
||||
<developers>
|
||||
<developer>
|
||||
<id>CarmJos</id>
|
||||
@@ -63,11 +72,6 @@
|
||||
|
||||
<distributionManagement>
|
||||
<downloadUrl>https://github.com/CarmJos/EasyPlugin/releases</downloadUrl>
|
||||
<repository>
|
||||
<id>github</id>
|
||||
<name>GitHub Packages</name>
|
||||
<url>https://maven.pkg.github.com/CarmJos/EasyPlugin</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
|
||||
<repositories>
|
||||
@@ -120,6 +124,26 @@
|
||||
|
||||
</dependencies>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>me.clip</groupId>
|
||||
<artifactId>placeholderapi</artifactId>
|
||||
<version>2.10.9</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.MilkBowl</groupId>
|
||||
<artifactId>VaultAPI</artifactId>
|
||||
<version>1.7</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cc.carm.lib</groupId>
|
||||
<artifactId>githubreleases4j</artifactId>
|
||||
<version>1.3.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
@@ -130,6 +154,39 @@
|
||||
<useSystemClassLoader>false</useSystemClassLoader>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<source>${project.jdk.version}</source>
|
||||
<target>${project.jdk.version}</target>
|
||||
<encoding>UTF-8</encoding>
|
||||
<compilerArgument>-parameters</compilerArgument>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>3.2.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>3.2.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>jar-no-fork</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
@@ -154,35 +211,6 @@
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<encoding>UTF-8</encoding>
|
||||
<compilerArgument>-parameters</compilerArgument>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>3.2.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>3.2.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>jar-no-fork</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
@@ -221,4 +249,47 @@
|
||||
</build>
|
||||
|
||||
|
||||
<profiles>
|
||||
|
||||
<profile>
|
||||
<id>ossrh</id>
|
||||
<distributionManagement>
|
||||
<snapshotRepository>
|
||||
<id>ossrh</id>
|
||||
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
|
||||
</snapshotRepository>
|
||||
<repository>
|
||||
<id>ossrh</id>
|
||||
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>github</id>
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>github</id>
|
||||
<name>GitHub Packages</name>
|
||||
<url>https://maven.pkg.github.com/CarmJos/EasyPlugin</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>local</id>
|
||||
<distributionManagement>
|
||||
<snapshotRepository>
|
||||
<id>localRepository</id>
|
||||
<url>file:${user.home}/local-deploy/</url>
|
||||
</snapshotRepository>
|
||||
<repository>
|
||||
<id>localRepository</id>
|
||||
<url>file:${user.home}/local-deploy/</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
</profile>
|
||||
|
||||
</profiles>
|
||||
|
||||
</project>
|
||||
Reference in New Issue
Block a user