1
mirror of https://github.com/CarmJos/MineConfiguration.git synced 2026-06-05 06:51:49 +08:00

Compare commits

...

35 Commits

Author SHA1 Message Date
carm 5905b25c73 chore(update): 适配上游版本更新。 2023-02-19 17:31:43 +08:00
carm 31f51c9b96 chore(update): 适配上游版本更新。 2023-02-19 17:28:58 +08:00
carm eb8f279e0b chore(update): 适配上游版本更新。 2023-02-19 17:28:45 +08:00
carm e291c3a109 chore(update): 适配上游版本更新。 2023-02-19 04:22:14 +08:00
carm 433f780608 chore(update): 适配上游版本更新。 2023-02-19 04:22:02 +08:00
carm 385f6dd22f chore(color): 使用由 EasyPlugin 提供的ColorParser。 2023-02-18 20:46:16 +08:00
dependabot[bot] 04168d4d12 chore(deps): bump maven-javadoc-plugin from 3.4.1 to 3.5.0 (#18)
Bumps [maven-javadoc-plugin](https://github.com/apache/maven-javadoc-plugin) from 3.4.1 to 3.5.0.
- [Release notes](https://github.com/apache/maven-javadoc-plugin/releases)
- [Commits](https://github.com/apache/maven-javadoc-plugin/compare/maven-javadoc-plugin-3.4.1...maven-javadoc-plugin-3.5.0)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-javadoc-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-16 19:24:11 +08:00
carm 143e0c2283 chore(update): 适配上游版本更新。 2023-02-11 21:54:59 +08:00
carm 4b4f90ee38 chore(update): 适配上游版本更新。 2023-02-11 21:54:35 +08:00
dependabot[bot] 97d24c7027 chore(deps): bump annotations from 23.1.0 to 24.0.0 (#17)
Bumps [annotations](https://github.com/JetBrains/java-annotations) from 23.1.0 to 24.0.0.
- [Release notes](https://github.com/JetBrains/java-annotations/releases)
- [Changelog](https://github.com/JetBrains/java-annotations/blob/master/CHANGELOG.md)
- [Commits](https://github.com/JetBrains/java-annotations/compare/23.1.0...24.0.0)

---
updated-dependencies:
- dependency-name: org.jetbrains:annotations
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-12 22:15:52 +08:00
carm d1b01ffed5 build(scm): 修复错误的scm地址 2022-12-18 04:54:29 +08:00
carm 67931094e6 refactor(proj): 放弃spigot项目,将Bukkit子项目单独提出。 2022-12-16 16:09:50 +08:00
carm 02f59b99f0 feat(msg): 添加 sendToEach 方法支持 2022-12-16 04:31:43 +08:00
carm e781d54348 feat(color): 完善ColorParser支持渐变RGB颜色。 2022-12-16 04:13:49 +08:00
carm bbd2c9e5e7 Merge remote-tracking branch 'origin/master' 2022-12-12 22:46:18 +08:00
carm ccc8cc6b72 feat(deps): 适配上游版本更新。 2022-12-12 22:36:20 +08:00
dependabot[bot] 1612e49326 chore(deps): bump annotations from 23.0.0 to 23.1.0 (#16)
Bumps [annotations](https://github.com/JetBrains/java-annotations) from 23.0.0 to 23.1.0.
- [Release notes](https://github.com/JetBrains/java-annotations/releases)
- [Changelog](https://github.com/JetBrains/java-annotations/blob/master/CHANGELOG.md)
- [Commits](https://github.com/JetBrains/java-annotations/compare/23.0.0...23.1.0)

---
updated-dependencies:
- dependency-name: org.jetbrains:annotations
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-10 11:35:23 +08:00
carm 2754f12cd5 fix(parse): 修复Number类型转换错误的问题。 2022-12-06 22:06:27 +08:00
dependabot[bot] c0f5d32ba0 chore(deps): bump maven-shade-plugin from 3.4.0 to 3.4.1 (#14)
Bumps [maven-shade-plugin](https://github.com/apache/maven-shade-plugin) from 3.4.0 to 3.4.1.
- [Release notes](https://github.com/apache/maven-shade-plugin/releases)
- [Commits](https://github.com/apache/maven-shade-plugin/compare/maven-shade-plugin-3.4.0...maven-shade-plugin-3.4.1)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-shade-plugin
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-02 18:31:09 +08:00
dependabot[bot] 6c355e0d89 chore(deps): bump maven-jar-plugin from 3.2.2 to 3.3.0 (#12)
Bumps [maven-jar-plugin](https://github.com/apache/maven-jar-plugin) from 3.2.2 to 3.3.0.
- [Release notes](https://github.com/apache/maven-jar-plugin/releases)
- [Commits](https://github.com/apache/maven-jar-plugin/compare/maven-jar-plugin-3.2.2...maven-jar-plugin-3.3.0)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-jar-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-22 00:22:14 +08:00
dependabot[bot] 6c7a5dd60a chore(deps): bump maven-shade-plugin from 3.3.0 to 3.4.0 (#11)
Bumps [maven-shade-plugin](https://github.com/apache/maven-shade-plugin) from 3.3.0 to 3.4.0.
- [Release notes](https://github.com/apache/maven-shade-plugin/releases)
- [Commits](https://github.com/apache/maven-shade-plugin/compare/maven-shade-plugin-3.3.0...maven-shade-plugin-3.4.0)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-shade-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-15 22:01:36 +08:00
carm 425d61834b chore: 移除重复方法 2022-09-10 01:33:47 +08:00
carm c9a272d052 fix(repo): 添加sonatype-repo 2022-09-10 01:23:23 +08:00
carm 327484cd53 feat(source): 为 ConfigurationWrapper 添加 getSource() 方法以获取源实现内容。 2022-09-10 01:17:10 +08:00
carm 99090929dd feat(source): 为 ConfigurationWrapper 添加 getSource() 方法以获取源实现内容。 2022-09-10 01:04:14 +08:00
carm 8437c4c904 feat(source): 为 ConfigurationWrapper 添加 getSource() 方法以获取源实现内容。 2022-09-10 01:04:04 +08:00
dependabot[bot] 21f7742d78 chore(deps): bump maven-javadoc-plugin from 3.4.0 to 3.4.1 (#9)
Bumps [maven-javadoc-plugin](https://github.com/apache/maven-javadoc-plugin) from 3.4.0 to 3.4.1.
- [Release notes](https://github.com/apache/maven-javadoc-plugin/releases)
- [Commits](https://github.com/apache/maven-javadoc-plugin/compare/maven-javadoc-plugin-3.4.0...maven-javadoc-plugin-3.4.1)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-javadoc-plugin
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-08-16 21:04:11 +08:00
dependabot[bot] 68e6280c94 chore(deps): bump placeholderapi from 2.11.1 to 2.11.2 (#7)
Bumps placeholderapi from 2.11.1 to 2.11.2.

---
updated-dependencies:
- dependency-name: me.clip:placeholderapi
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-07-05 14:44:26 +08:00
carm 9a8e6395bb fix(text): 令 AbstractText#parse 返回值不得为null,避免在List类型循环parse时出现异常。 2022-06-21 05:03:16 +08:00
carm 7fa6fa1551 feat(item): 为ItemConfig添加 ItemFlag 与 enchant 相关配置 2022-06-18 06:10:17 +08:00
carm 346ae4c494 feat(item): 为ItemConfig添加 ItemFlag 与 enchant 相关配置 2022-06-18 06:00:39 +08:00
carm 2d8c1817a6 feat(item): 为ItemConfig添加 ItemFlag 与 enchant 相关配置 2022-06-18 05:56:58 +08:00
carm f67d0fae8d feat(item): 为ItemConfig添加 ItemFlag 与 enchant 相关配置 2022-06-18 05:56:43 +08:00
carm 8d723df7a6 chore(sound): 添加输入长度判断,适用于不想发送声音的情况。 2022-06-17 22:57:05 +08:00
carm d4c7124d9e chore(sound): 添加输入长度判断,适用于不想发送声音的情况。 2022-06-17 22:56:47 +08:00
52 changed files with 489 additions and 612 deletions
+1 -1
View File
@@ -30,7 +30,7 @@ jobs:
rm -rf docs
mkdir -vp docs
cp -vrf target/site/apidocs/* docs/
cp -vrf .documentation/javadoc/JAVADOC-README.md docs/README.md
cp -vrf .doc/javadoc/JAVADOC-README.md docs/README.md
- name: "Generate Sitemap"
id: sitemap
+10 -19
View File
@@ -20,44 +20,35 @@ EasyConfiguration for MineCraft!
## 项目结构
### **MineConfiguration-Common**
### **MineConfiguration-Common** [`common`](common)
全部版本的共用部分,包括
全部版本的共用部分(均已被打包至下行包中),包括
- `ConfigMessage` (实现类为 `ConfiguredMessage<M>`)
- `ConfigMessageList` (实现类为 `ConfiguredMessageList<M>`)
如要使用,请访问对应实现类的builder() 方法来快速创建。
### MineConfiguration-Bukkit
### **MineConfiguration-Bukkit** [`platform/bukkit`](platform/bukkit)
#### MineConfiguration-Bukkit-Base
Bukkit系通用依赖,不包含实现部分,请使用 **MineConfiguration-Bukkit-General****MineConfiguration-Bukkit-Native**
适用于Bukkit的版本,同时支持其他以Bukkit为基础的服务端 *(如Spigot、Paper、CatServer)*
相较于基础版本,额外提供了以下功能:
- `ConfiguredSerializable<T extends ConfigurationSerializable>`
- `ConfiguredItem` (快捷读简单的物品配置文件)
- `ConfiguredSound` (快捷读音效配置文件)
- `ConfiguredItem` (快捷读\写\使用简单的物品配置文件)
- `ConfiguredSound` (快捷读\写\使用音效配置文件)
- `ConfiguredTitle` (快速读\写\使用标题文字配置文件)
以上类型可以通过 `CraftConfigValue.builder()` 来创建,部分类型提供了 `of(...);` 方法来快速创建。
#### **MineConfiguration-Bukkit** _(推荐)_
适用于Bukkit的版本,包含以Bukkit为基础的其他服务端 *(如Spigot、Paper、CatServer)*
#### **MineConfiguration-Spigot**
适用于 Spigot(1.18+) 的版本,适配了1.18及以后版本Spigot原生自带的配置文件注释功能,随Spigot更新而优化,安全稳定。
### **MineConfiguration-Bungee**
### **MineConfiguration-Bungee** [`platform/bungee`](platform/bungee)
适用于BungeeCord的版本,可用JSON与YAML格式。其中JSON格式**不支持配置文件注释**。
## 开发
请详见 [EasyConfiguration](https://github.com/CarmJos/EasyConfiguration)
其他功能请详见 [EasyConfiguration](https://github.com/CarmJos/EasyConfiguration)
的 [开发介绍](https://github.com/CarmJos/EasyConfiguration/tree/master/.documentation) 。
### 依赖方式
@@ -113,7 +104,7 @@ Bukkit系通用依赖,不包含实现部分,请使用 **MineConfiguration-Bu
<version>[LATEST RELEASE]</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>cc.carm.lib</groupId>
<artifactId>mineconfiguration-spigot</artifactId>
+16 -3
View File
@@ -5,24 +5,37 @@
<parent>
<artifactId>mineconfiguration-parent</artifactId>
<groupId>cc.carm.lib</groupId>
<version>2.0.0</version>
<version>2.4.0</version>
</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>mineconfiguration-common</artifactId>
<name>MineConfiguration-Common</name>
<description>轻松(做)配置,全部版本的共用部分。</description>
<dependencies>
<dependency>
<groupId>${project.parent.groupId}</groupId>
<groupId>cc.carm.lib</groupId>
<artifactId>easyconfiguration-core</artifactId>
<version>${easyconfiguration.version}</version>
<version>${deps.easyconfifuration.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>cc.carm.lib</groupId>
<artifactId>easyplugin-color</artifactId>
<version>${deps.easyplugin.version}</version>
<scope>compile</scope>
</dependency>
<!--suppress VulnerableLibrariesLocal -->
<dependency>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-chat</artifactId>
@@ -28,16 +28,14 @@ public abstract class AbstractText<R> {
return this.message;
}
public <M> @Nullable M parse(@NotNull BiFunction<@Nullable R, @NotNull String, @NotNull M> parser,
@Nullable R receiver, @Nullable String[] params, @Nullable Object[] values) {
public <M> @NotNull M parse(@NotNull BiFunction<@Nullable R, @NotNull String, @NotNull M> parser,
@Nullable R receiver, @Nullable String[] params, @Nullable Object[] values) {
return parse(parser, receiver, ParamsUtils.buildParams(params, values));
}
public <M> @Nullable M parse(@NotNull BiFunction<@Nullable R, @NotNull String, @NotNull M> parser,
@Nullable R receiver, @NotNull Map<String, Object> placeholders) {
String message = getMessage();
if (message.isEmpty()) return null; // No further processing
else return parser.apply(receiver, ParamsUtils.setPlaceholders(message, placeholders));
public <M> @NotNull M parse(@NotNull BiFunction<@Nullable R, @NotNull String, @NotNull M> parser,
@Nullable R receiver, @NotNull Map<String, Object> placeholders) {
return parser.apply(receiver, ParamsUtils.setPlaceholders(message, placeholders));
}
@@ -1,44 +0,0 @@
package cc.carm.lib.mineconfiguration.common.utils;
import java.util.Arrays;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
public class ColorParser {
public static Pattern HEX_PATTERN = Pattern.compile("&\\(&?#([0-9a-fA-F]{6})\\)");
public static String parse(String text) {
return parseBaseColor(parseHexColor(text));
}
public static String[] parse(String... texts) {
return parse(Arrays.asList(texts)).toArray(new String[0]);
}
public static List<String> parse(List<String> texts) {
return texts.stream().map(ColorParser::parse).collect(Collectors.toList());
}
public static String parseBaseColor(final String text) {
return text.replaceAll("&", "§").replace("§§", "&");
}
public static String parseHexColor(String text) {
Matcher matcher = HEX_PATTERN.matcher(text);
while (matcher.find()) {
text = matcher.replaceFirst(buildHexColor(matcher.group(1)).toLowerCase());
matcher.reset(text);
}
return text;
}
private static String buildHexColor(String hexCode) {
return Arrays.stream(hexCode.split(""))
.map(s -> '§' + s)
.collect(Collectors.joining("", '§' + "x", ""));
}
}
@@ -0,0 +1,147 @@
package cc.carm.lib.mineconfiguration.common.value;
import cc.carm.lib.mineconfiguration.common.builder.message.MessageValueBuilder;
import cc.carm.lib.mineconfiguration.common.utils.ParamsUtils;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.Unmodifiable;
import java.util.Map;
import java.util.Optional;
import java.util.function.Function;
import java.util.function.Predicate;
public interface BaseMessage<R, M> {
/**
* 得到所有的接收者
*
* @return 全部可能的接收者
*/
@Unmodifiable
@NotNull Iterable<R> getAllReceivers();
/**
* 得到消息中的通过 {@link MessageValueBuilder#params(String...)}已定变量名(按定义顺序)
*
* @return 已定变量
*/
@NotNull String[] getParams();
/**
* 向接收者发送消息的根方法。
*
* @param receiver 接收者
* @param message 消息内容
*/
@ApiStatus.OverrideOnly
void apply(@NotNull R receiver, @NotNull M message);
/**
* 为某位接收者解析此消息。
*
* @param sender 接收者
* @param placeholders 消息中的变量与对应参数
* @return 解析变量后的消息内容
*/
@Nullable M parse(@Nullable R sender, @NotNull Map<String, Object> placeholders);
/**
* 为某位接收者解析此消息。
*
* @param sender 接收者
* @param values 已定变量的对应参数
* @return 解析变量后的消息内容
*/
default @Nullable M parse(@Nullable R sender, @Nullable Object... values) {
return parse(sender, ParamsUtils.buildParams(getParams(), values));
}
/**
* 向某位接收者发送消息
*
* @param receiver 消息的接收者
* @param values 已定变量的对应参数
*/
default void send(@Nullable R receiver, @Nullable Object... values) {
send(receiver, ParamsUtils.buildParams(getParams(), values));
}
/**
* 向某位接收者发送消息
*
* @param receiver 消息的接收者
* @param placeholders 消息中的变量与对应参数
*/
default void send(@Nullable R receiver, @NotNull Map<String, Object> placeholders) {
if (receiver == null) return;
M parsed = parse(receiver, placeholders);
if (parsed == null) return;
apply(receiver, parsed);
}
/**
* 向全部接收者(包括后台)发送不同参数的消息
*
* @param eachValues 每位接收者将收到已定变量的对应参数(按定义顺序)
*/
default void sendToEach(@NotNull Function<@NotNull R, Object[]> eachValues) {
sendToEach(null, eachValues);
}
/**
* 向特定接收者发送不同参数的消息
*
* @param limiter 接收者限定器,为空则不限定接收者。
* @param eachValues 每位接收者将收到已定变量的对应参数(按定义顺序)
*/
default void sendToEach(@Nullable Predicate<R> limiter,
@NotNull Function<@NotNull R, Object[]> eachValues) {
Predicate<R> predicate = Optional.ofNullable(limiter).orElse(r -> true);
for (R r : getAllReceivers()) {
if (predicate.test(r)) {
send(r, ParamsUtils.buildParams(getParams(), eachValues.apply(r)));
}
}
}
/**
* 广播此消息(包括后台)
*
* @param values 已定变量的对应参数(按定义顺序)
*/
default void sendToAll(@Nullable Object... values) {
broadcast(values);
}
/**
* 广播此消息(包括后台)
*
* @param placeholders 消息中的变量与对应参数
*/
default void sendToAll(@NotNull Map<String, Object> placeholders) {
broadcast(placeholders);
}
/**
* 广播此消息(包括后台)
*
* @param values 已定变量的对应参数(按定义顺序)
*/
default void broadcast(@Nullable Object... values) {
broadcast(ParamsUtils.buildParams(getParams(), values));
}
/**
* 广播此消息(包括后台)
*
* @param placeholders 消息中的变量与对应参数
*/
default void broadcast(@NotNull Map<String, Object> placeholders) {
getAllReceivers().forEach(r -> send(r, placeholders));
}
}
@@ -1,10 +1,9 @@
package cc.carm.lib.mineconfiguration.common.value;
import cc.carm.lib.mineconfiguration.common.data.AbstractText;
import cc.carm.lib.mineconfiguration.common.utils.ParamsUtils;
import cc.carm.lib.configuration.core.function.ConfigValueParser;
import cc.carm.lib.configuration.core.source.ConfigurationProvider;
import cc.carm.lib.configuration.core.value.type.ConfiguredValue;
import cc.carm.lib.mineconfiguration.common.data.AbstractText;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -15,11 +14,11 @@ import java.util.function.BiFunction;
import java.util.function.Function;
public abstract class ConfigMessage<M, T extends AbstractText<R>, R>
extends ConfiguredValue<T> {
extends ConfiguredValue<T> implements BaseMessage<R, M> {
protected final @NotNull String[] params;
protected final @NotNull BiFunction<@Nullable R, @NotNull String, @Nullable M> messageParser;
protected final @NotNull BiConsumer<@NotNull R, @NotNull M> messageConsumer;
protected final @NotNull BiConsumer<@NotNull R, @NotNull M> sendFunction;
protected final @NotNull Function<String, T> textBuilder;
@@ -27,44 +26,35 @@ public abstract class ConfigMessage<M, T extends AbstractText<R>, R>
@Nullable List<String> headerComments, @Nullable String inlineComments,
@NotNull Class<T> textClazz, @NotNull T defaultMessage, @NotNull String[] params,
@NotNull BiFunction<@Nullable R, @NotNull String, @Nullable M> messageParser,
@NotNull BiConsumer<@NotNull R, @NotNull M> messageConsumer,
@NotNull BiConsumer<@NotNull R, @NotNull M> sendFunction,
@NotNull Function<String, T> textBuilder) {
super(provider, sectionPath, headerComments, inlineComments, textClazz, defaultMessage,
super(
provider, sectionPath, headerComments, inlineComments, textClazz, defaultMessage,
ConfigValueParser.castToString().andThen((s, d) -> textBuilder.apply(s)), AbstractText::getMessage
);
this.params = params;
this.messageParser = messageParser;
this.messageConsumer = messageConsumer;
this.sendFunction = sendFunction;
this.textBuilder = textBuilder;
}
public @Nullable M parse(@Nullable R sender, @Nullable Object... values) {
return parse(sender, ParamsUtils.buildParams(params, values));
@Override
public String[] getParams() {
return params;
}
@Override
public void apply(@NotNull R receiver, @NotNull M message) {
sendFunction.accept(receiver, message);
}
@Override
public @Nullable M parse(@Nullable R sender, @NotNull Map<String, Object> placeholders) {
T value = get();
if (value == null || value.getMessage().isEmpty()) return null;
else return value.parse(this.messageParser, sender, placeholders);
}
public void send(@Nullable R receiver, @Nullable Object... values) {
send(receiver, ParamsUtils.buildParams(params, values));
}
public void send(@Nullable R receiver, @NotNull Map<String, Object> placeholders) {
if (receiver == null) return;
M parsed = parse(receiver, placeholders);
if (parsed == null) return;
messageConsumer.accept(receiver, parsed);
}
public void broadcast(@Nullable Object... values) {
broadcast(ParamsUtils.buildParams(params, values));
}
public abstract void broadcast(@NotNull Map<String, Object> placeholders);
public void set(@Nullable String value) {
this.set(value == null ? null : buildText(value));
}
@@ -72,4 +62,5 @@ public abstract class ConfigMessage<M, T extends AbstractText<R>, R>
protected T buildText(String value) {
return textBuilder.apply(value);
}
}
@@ -1,10 +1,9 @@
package cc.carm.lib.mineconfiguration.common.value;
import cc.carm.lib.mineconfiguration.common.utils.ParamsUtils;
import cc.carm.lib.mineconfiguration.common.data.AbstractText;
import cc.carm.lib.configuration.core.function.ConfigDataFunction;
import cc.carm.lib.configuration.core.source.ConfigurationProvider;
import cc.carm.lib.configuration.core.value.type.ConfiguredList;
import cc.carm.lib.mineconfiguration.common.data.AbstractText;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -16,7 +15,8 @@ import java.util.function.BiFunction;
import java.util.function.Function;
import java.util.stream.Collectors;
public abstract class ConfigMessageList<M, T extends AbstractText<R>, R> extends ConfiguredList<T> {
public abstract class ConfigMessageList<M, T extends AbstractText<R>, R>
extends ConfiguredList<T> implements BaseMessage<R, List<M>> {
protected final @NotNull String[] params;
protected final @NotNull BiFunction<@Nullable R, @NotNull String, @Nullable M> messageParser;
@@ -24,7 +24,6 @@ public abstract class ConfigMessageList<M, T extends AbstractText<R>, R> extends
protected final @NotNull Function<String, T> textBuilder;
@SuppressWarnings("NullableProblems")
public ConfigMessageList(@Nullable ConfigurationProvider<?> provider, @Nullable String sectionPath,
@Nullable List<String> headerComments, @Nullable String inlineComments,
@NotNull Class<T> textClazz, @NotNull List<T> messages, @NotNull String[] params,
@@ -41,38 +40,34 @@ public abstract class ConfigMessageList<M, T extends AbstractText<R>, R> extends
this.textBuilder = textBuilder;
}
public @Nullable List<M> parse(@Nullable R sender, @Nullable Object... values) {
return parse(sender, ParamsUtils.buildParams(params, values));
@Override
public String[] getParams() {
return params;
}
public @Nullable List<M> parse(@Nullable R sender, @NotNull Map<String, Object> placeholders) {
@Override
public void apply(@NotNull R receiver, @NotNull List<M> message) {
sendFunction.accept(receiver, message);
}
/**
* 为某位接收者解析消息
*
* @param receiver 消息的接收者
* @param placeholders 消息中的变量与对应参数
*/
@Override
public @Nullable List<M> parse(@Nullable R receiver, @NotNull Map<String, Object> placeholders) {
List<T> list = get();
if (list.isEmpty()) return null;
List<String> messages = list.stream().map(T::getMessage).collect(Collectors.toList());
if (String.join("", messages).isEmpty()) return null;
return list.stream().map(value -> value.parse(this.messageParser, sender, placeholders))
return list.stream().map(value -> value.parse(this.messageParser, receiver, placeholders))
.collect(Collectors.toList());
}
public void send(@Nullable R receiver, @Nullable Object... values) {
send(receiver, ParamsUtils.buildParams(params, values));
}
public void send(@Nullable R receiver, @NotNull Map<String, Object> placeholders) {
if (receiver == null) return;
List<M> parsed = parse(receiver, placeholders);
if (parsed == null) return;
sendFunction.accept(receiver, parsed);
}
public void broadcast(@Nullable Object... values) {
broadcast(ParamsUtils.buildParams(params, values));
}
public abstract void broadcast(@NotNull Map<String, Object> placeholders);
public void setMessages(@NotNull String... values) {
setMessages(values.length == 0 ? null : Arrays.asList(values));
}
@@ -83,7 +78,6 @@ public abstract class ConfigMessageList<M, T extends AbstractText<R>, R> extends
} else {
set(buildText(values));
}
}
protected List<T> buildText(List<String> values) {
-38
View File
@@ -1,38 +0,0 @@
<?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>mineconfiguration-bukkit-parent</artifactId>
<groupId>cc.carm.lib</groupId>
<version>2.0.0</version>
</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>
</properties>
<artifactId>mineconfiguration-bukkit-base</artifactId>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>${project.parent.groupId}</groupId>
<artifactId>mineconfiguration-common</artifactId>
<version>${project.parent.version}</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
-39
View File
@@ -1,39 +0,0 @@
<?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>mineconfiguration-bukkit-parent</artifactId>
<groupId>cc.carm.lib</groupId>
<version>2.0.0</version>
</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>
</properties>
<artifactId>mineconfiguration-bukkit</artifactId>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>${project.parent.groupId}</groupId>
<artifactId>mineconfiguration-bukkit-base</artifactId>
<version>${project.parent.version}</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
+25 -9
View File
@@ -5,25 +5,32 @@
<parent>
<artifactId>mineconfiguration-parent</artifactId>
<groupId>cc.carm.lib</groupId>
<version>2.0.0</version>
<version>2.4.0</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>mineconfiguration-bukkit-parent</artifactId>
<packaging>pom</packaging>
<modules>
<module>base</module>
<module>general</module>
</modules>
<artifactId>mineconfiguration-bukkit</artifactId>
<packaging>jar</packaging>
<name>MineConfiguration-Bukkit-Parent</name>
<name>MineConfiguration-Bukkit</name>
<description>轻松(做)配置,适用于Bukkit系服务端的版本。</description>
<dependencies>
<dependency>
<groupId>${project.parent.groupId}</groupId>
<artifactId>mineconfiguration-common</artifactId>
<version>${project.parent.version}</version>
<scope>compile</scope>
</dependency>
<!--suppress VulnerableLibrariesLocal -->
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
@@ -35,7 +42,7 @@
<dependency>
<groupId>me.clip</groupId>
<artifactId>placeholderapi</artifactId>
<version>2.11.1</version>
<version>2.11.2</version>
<scope>provided</scope>
</dependency>
@@ -49,4 +56,13 @@
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
@@ -25,7 +25,7 @@ public abstract class CraftConfigValue<T> extends CachedConfigValue<T> {
public CraftConfigProvider getBukkitProvider() {
ConfigurationProvider<?> provider = getProvider();
if (provider instanceof CraftConfigProvider) return (CraftConfigProvider) getProvider();
else throw new IllegalStateException("Provider is not a SpigotConfigProvider");
else throw new IllegalStateException("Provider is not a CraftConfigProvider");
}
public CraftSectionWrapper getBukkitConfig() {
@@ -38,4 +38,5 @@ public class MineConfiguration {
public static BukkitConfigProvider from(Plugin plugin, String fileName, String source) {
return from(new File(plugin.getDataFolder(), fileName), source);
}
}
@@ -5,13 +5,12 @@ import cc.carm.lib.mineconfiguration.bukkit.data.ItemConfig;
import cc.carm.lib.mineconfiguration.bukkit.value.ConfiguredItem;
import cc.carm.lib.mineconfiguration.common.utils.ParamsUtils;
import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemFlag;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.*;
import java.util.function.Function;
public class ItemConfigBuilder extends AbstractCraftBuilder<ItemConfig, ItemConfigBuilder> {
@@ -21,6 +20,9 @@ public class ItemConfigBuilder extends AbstractCraftBuilder<ItemConfig, ItemConf
protected String name = null;
protected List<String> lore = new ArrayList<>();
protected Map<Enchantment, Integer> enchants = new LinkedHashMap<>();
protected Set<ItemFlag> flags = new LinkedHashSet<>();
protected @NotNull String[] params = new String[0];
protected @NotNull Function<@NotNull String, @NotNull String> paramFormatter = ParamsUtils.DEFAULT_PARAM_FORMATTER;
@@ -63,6 +65,24 @@ public class ItemConfigBuilder extends AbstractCraftBuilder<ItemConfig, ItemConf
return this;
}
public ItemConfigBuilder defaultEnchants(@NotNull Map<Enchantment, Integer> enchants) {
this.enchants = new LinkedHashMap<>(enchants);
return this;
}
public ItemConfigBuilder defaultEnchant(@NotNull Enchantment enchant, int level) {
return defaultEnchants(Collections.singletonMap(enchant, level));
}
public ItemConfigBuilder defaultFlags(@NotNull Set<ItemFlag> flags) {
this.flags = new LinkedHashSet<>(flags);
return this;
}
public ItemConfigBuilder defaultFlags(@NotNull ItemFlag... flags) {
return defaultFlags(new LinkedHashSet<>(Arrays.asList(flags)));
}
public ItemConfigBuilder formatParam(@NotNull Function<@NotNull String, @NotNull String> paramFormatter) {
this.paramFormatter = paramFormatter;
return getThis();
@@ -85,7 +105,7 @@ public class ItemConfigBuilder extends AbstractCraftBuilder<ItemConfig, ItemConf
protected @Nullable ItemConfig buildDefault() {
if (this.type == null) return null;
else return new ItemConfig(type, data, name, lore);
else return new ItemConfig(type, data, name, lore, enchants, flags);
}
@Override
@@ -1,15 +1,20 @@
package cc.carm.lib.mineconfiguration.bukkit.data;
import cc.carm.lib.configuration.core.source.ConfigurationWrapper;
import cc.carm.lib.mineconfiguration.bukkit.source.CraftSectionWrapper;
import cc.carm.lib.mineconfiguration.bukkit.utils.TextParser;
import org.bukkit.Material;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.*;
import java.util.stream.Collectors;
public class ItemConfig {
@@ -18,12 +23,32 @@ public class ItemConfig {
protected @Nullable String name;
protected @NotNull List<String> lore;
protected @NotNull Map<Enchantment, Integer> enchants;
protected @NotNull Set<ItemFlag> flags;
public ItemConfig(@NotNull Material type, @Nullable String name) {
this(type, name, Collections.emptyList());
}
public ItemConfig(@NotNull Material type, @Nullable String name, @NotNull List<String> lore) {
this(type, (short) 0, name, lore);
}
public ItemConfig(@NotNull Material type, short damage,
@Nullable String name, @NotNull List<String> lore) {
this(type, damage, name, lore, Collections.emptyMap(), Collections.emptySet());
}
public ItemConfig(@NotNull Material type, short damage,
@Nullable String name, @NotNull List<String> lore,
@NotNull Map<Enchantment, Integer> enchants,
@NotNull Set<ItemFlag> flags) {
this.type = type;
this.data = damage;
this.name = name;
this.lore = lore;
this.enchants = enchants;
this.flags = flags;
}
public @NotNull Material getType() {
@@ -75,6 +100,8 @@ public class ItemConfig {
if (meta == null) return item;
Optional.ofNullable(getName(player, placeholders)).ifPresent(meta::setDisplayName);
Optional.ofNullable(getLore(player, placeholders)).ifPresent(meta::setLore);
enchants.forEach((enchant, level) -> meta.addEnchant(enchant, level, true));
flags.forEach(meta::addItemFlags);
item.setItemMeta(meta);
return item;
}
@@ -86,20 +113,66 @@ public class ItemConfig {
if (name != null) map.put("name", name);
if (!lore.isEmpty()) map.put("lore", lore);
Map<String, Integer> enchantments = new LinkedHashMap<>();
enchants.forEach((enchant, level) -> {
if (level > 0) enchantments.put(enchant.getName(), level);
});
if (!enchantments.isEmpty()) {
map.put("enchants", enchantments);
}
if (!flags.isEmpty()) {
map.put("flags", flags.stream().map(ItemFlag::name).collect(Collectors.toList()));
}
return map;
}
public static @NotNull ItemConfig deserialize(@NotNull ConfigurationWrapper section) throws Exception {
public static @NotNull ItemConfig deserialize(@NotNull ConfigurationSection section) throws Exception {
return deserialize(CraftSectionWrapper.of(section));
}
public static @NotNull ItemConfig deserialize(@NotNull ConfigurationWrapper<?> section) throws Exception {
String typeName = section.getString("type");
if (typeName == null) throw new NullPointerException("Item type name is null");
Material type = Material.matchMaterial(typeName);
if (type == null) throw new Exception("Invalid material name: " + typeName);
else return new ItemConfig(
type, section.getShort("data", (short) 0),
section.getString("name"),
section.getStringList("lore")
);
short data = section.getShort("data", (short) 0);
String name = section.getString("name");
List<String> lore = section.getStringList("lore");
Map<Enchantment, Integer> enchantments = readEnchantments(section.getConfigurationSection("enchants"));
Set<ItemFlag> flags = readFlags(section.getStringList("flags"));
return new ItemConfig(type, data, name, lore, enchantments, flags);
}
private static ItemFlag parseFlag(String flagName) {
return Arrays.stream(ItemFlag.values()).filter(flag -> flag.name().equalsIgnoreCase(flagName)).findFirst().orElse(null);
}
private static Set<ItemFlag> readFlags(List<String> flagConfig) {
Set<ItemFlag> flags = new LinkedHashSet<>();
for (String flagName : flagConfig) {
ItemFlag flag = parseFlag(flagName);
if (flag != null) flags.add(flag);
}
return flags;
}
private static Map<Enchantment, Integer> readEnchantments(ConfigurationWrapper<?> section) {
Map<Enchantment, Integer> enchantments = new LinkedHashMap<>();
if (section == null) return enchantments;
section.getKeys(false).forEach(key -> {
Enchantment enchantment = Enchantment.getByName(key);
int level = section.getInt(key, 0);
if (enchantment != null && level > 0) {
enchantments.put(enchantment, level);
}
});
return enchantments;
}
}
@@ -85,7 +85,7 @@ public class SoundConfig {
@Contract("null -> null")
public static @Nullable SoundConfig deserialize(@Nullable String string) throws Exception {
if (string == null) return null;
if (string == null || string.isEmpty()) return null;
String[] args = string.contains(":") ? string.split(":") : new String[]{string};
if (args.length < 1) return null;
@@ -61,7 +61,7 @@ public class TitleConfig {
return map;
}
public static @NotNull TitleConfig deserialize(@NotNull ConfigurationWrapper section) {
public static @NotNull TitleConfig deserialize(@NotNull ConfigurationWrapper<?> section) {
return of(section.getString("line1"), section.getString("line2"));
}
@@ -1,10 +1,10 @@
package cc.carm.lib.mineconfiguration.bukkit.source;
import cc.carm.lib.configuration.core.ConfigInitializer;
import cc.carm.lib.configuration.core.source.ConfigurationComments;
import org.bukkit.configuration.file.YamlConfiguration;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.Unmodifiable;
import java.io.BufferedWriter;
import java.io.File;
@@ -12,13 +12,12 @@ import java.io.StringWriter;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
public class BukkitConfigProvider extends CraftConfigProvider {
protected static final char SEPARATOR = '.';
protected BukkitYAMLComments bukkitComments = new BukkitYAMLComments();
protected @NotNull BukkitYAMLComments comments = new BukkitYAMLComments();
public BukkitConfigProvider(@NotNull File file) {
super(file);
@@ -39,7 +38,7 @@ public class BukkitConfigProvider extends CraftConfigProvider {
configuration.save(getFile());
StringWriter writer = new StringWriter();
this.bukkitComments.writeComments(configuration, new BufferedWriter(writer));
this.comments.writeComments(configuration, new BufferedWriter(writer));
String value = writer.toString(); // config contents
Path toUpdatePath = getFile().toPath();
@@ -49,24 +48,8 @@ public class BukkitConfigProvider extends CraftConfigProvider {
}
@Override
public void setHeaderComment(@Nullable String path, @Nullable List<String> comments) {
this.bukkitComments.setHeaderComments(path, comments);
public @Nullable ConfigurationComments getComments() {
return this.comments;
}
@Override
public void setInlineComment(@NotNull String path, @Nullable String comment) {
this.bukkitComments.setInlineComment(path, comment);
}
@Override
@Nullable
@Unmodifiable
public List<String> getHeaderComment(@Nullable String path) {
return this.bukkitComments.getHeaderComment(path);
}
@Override
public @Nullable String getInlineComment(@NotNull String path) {
return this.bukkitComments.getInlineComment(path);
}
}
@@ -1,58 +1,20 @@
package cc.carm.lib.mineconfiguration.bukkit.source;
import cc.carm.lib.configuration.core.source.ConfigurationComments;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.Unmodifiable;
import java.io.BufferedWriter;
import java.io.IOException;
import java.util.*;
import java.util.List;
import java.util.StringJoiner;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
public class BukkitYAMLComments {
protected final @NotNull Map<String, List<String>> headerComments = new HashMap<>();
protected final @NotNull Map<String, String> inlineComments = new HashMap<>();
protected @NotNull Map<String, List<String>> getHeaderComments() {
return headerComments;
}
protected @NotNull Map<String, String> getInlineComments() {
return inlineComments;
}
public void setHeaderComments(@Nullable String path, @Nullable List<String> comments) {
if (comments == null) {
getHeaderComments().remove(path);
} else {
getHeaderComments().put(path, comments);
}
}
public void setInlineComment(@NotNull String path, @Nullable String comment) {
if (comment == null) {
getInlineComments().remove(path);
} else {
getInlineComments().put(path, comment);
}
}
@Nullable
@Unmodifiable
public List<String> getHeaderComment(@Nullable String path) {
return Optional.ofNullable(getHeaderComments().get(path)).map(Collections::unmodifiableList).orElse(null);
}
public @Nullable String getInlineComment(@NotNull String path) {
return getInlineComments().get(path);
}
public class BukkitYAMLComments extends ConfigurationComments {
public @Nullable String buildHeaderComments(@Nullable String path, @NotNull String indents) {
List<String> comments = getHeaderComment(path);
@@ -10,61 +10,62 @@ import java.util.Map;
import java.util.Optional;
import java.util.Set;
public class CraftSectionWrapper implements ConfigurationWrapper {
public class CraftSectionWrapper implements ConfigurationWrapper<ConfigurationSection> {
protected final ConfigurationSection section;
protected final ConfigurationSection configuration;
protected CraftSectionWrapper(ConfigurationSection section) {
this.section = section;
protected CraftSectionWrapper(ConfigurationSection configuration) {
this.configuration = configuration;
}
public ConfigurationSection getSourceSection() {
return section;
@Override
public @NotNull ConfigurationSection getSource() {
return this.configuration;
}
@Override
public @NotNull Set<String> getKeys(boolean deep) {
return this.section.getKeys(deep);
return this.configuration.getKeys(deep);
}
@Override
public @NotNull Map<String, Object> getValues(boolean deep) {
return this.section.getValues(deep);
return this.configuration.getValues(deep);
}
@Override
public void set(@NotNull String path, @Nullable Object value) {
this.section.set(path, value);
this.configuration.set(path, value);
}
@Override
public boolean contains(@NotNull String path) {
return this.section.contains(path);
return this.configuration.contains(path);
}
@Override
public @Nullable Object get(@NotNull String path) {
return this.section.get(path);
return this.configuration.get(path);
}
@Override
public boolean isList(@NotNull String path) {
return this.section.isList(path);
return this.configuration.isList(path);
}
@Override
public @Nullable List<?> getList(@NotNull String path) {
return this.section.getList(path);
return this.configuration.getList(path);
}
@Override
public boolean isConfigurationSection(@NotNull String path) {
return this.section.isConfigurationSection(path);
return this.configuration.isConfigurationSection(path);
}
@Override
public @Nullable ConfigurationWrapper getConfigurationSection(@NotNull String path) {
return Optional.ofNullable(section.getConfigurationSection(path))
public @Nullable CraftSectionWrapper getConfigurationSection(@NotNull String path) {
return Optional.ofNullable(configuration.getConfigurationSection(path))
.map(CraftSectionWrapper::of).orElse(null);
}
@@ -7,11 +7,12 @@ import com.comphenix.protocol.events.PacketContainer;
import com.comphenix.protocol.wrappers.EnumWrappers;
import com.comphenix.protocol.wrappers.WrappedChatComponent;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
public class ProtocolLibHelper {
@SuppressWarnings("deprecation")
public static void sendTitle(Player player, long fadeIn, long stay, long fadeOut, String line1, String line2) throws Exception {
public static void sendTitle(@NotNull Player player, long fadeIn, long stay, long fadeOut, String line1, String line2) throws Exception {
ProtocolManager pm = ProtocolLibrary.getProtocolManager();
if (line1 != null) {
@@ -35,7 +36,6 @@ public class ProtocolLibHelper {
.write(1, Math.toIntExact(stay))
.write(2, Math.toIntExact(fadeOut));
pm.sendServerPacket(player, timePacket, false);
}
}
@@ -1,6 +1,6 @@
package cc.carm.lib.mineconfiguration.bukkit.utils;
import cc.carm.lib.mineconfiguration.common.utils.ColorParser;
import cc.carm.lib.easyplugin.utils.ColorParser;
import cc.carm.lib.mineconfiguration.common.utils.ParamsUtils;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
@@ -1,13 +1,13 @@
package cc.carm.lib.mineconfiguration.bukkit.value;
import cc.carm.lib.mineconfiguration.bukkit.CraftConfigValue;
import cc.carm.lib.mineconfiguration.bukkit.data.ItemConfig;
import cc.carm.lib.mineconfiguration.common.utils.ParamsUtils;
import cc.carm.lib.configuration.core.function.ConfigValueParser;
import cc.carm.lib.configuration.core.source.ConfigurationProvider;
import cc.carm.lib.configuration.core.source.ConfigurationWrapper;
import cc.carm.lib.configuration.core.value.type.ConfiguredSection;
import cc.carm.lib.mineconfiguration.bukkit.CraftConfigValue;
import cc.carm.lib.mineconfiguration.bukkit.builder.item.ItemConfigBuilder;
import cc.carm.lib.mineconfiguration.bukkit.data.ItemConfig;
import cc.carm.lib.mineconfiguration.bukkit.source.CraftConfigProvider;
import cc.carm.lib.mineconfiguration.common.utils.ParamsUtils;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
@@ -33,14 +33,17 @@ public class ConfiguredItem extends ConfiguredSection<ItemConfig> {
protected final @NotNull String[] params;
public ConfiguredItem(@Nullable ConfigurationProvider<?> provider, @Nullable String sectionPath,
public ConfiguredItem(@Nullable CraftConfigProvider provider, @Nullable String sectionPath,
@Nullable List<String> headerComments, @Nullable String inlineComments,
@Nullable ItemConfig defaultValue, @NotNull String[] params) {
super(provider, sectionPath, headerComments, inlineComments, ItemConfig.class, defaultValue, getItemParser(), ItemConfig::serialize);
super(
provider, sectionPath, headerComments, inlineComments, ItemConfig.class, defaultValue,
getItemParser(), ItemConfig::serialize
);
this.params = params;
}
public static ConfigValueParser<ConfigurationWrapper, ItemConfig> getItemParser() {
public static ConfigValueParser<ConfigurationWrapper<?>, ItemConfig> getItemParser() {
return (s, d) -> ItemConfig.deserialize(s);
}
@@ -1,17 +1,18 @@
package cc.carm.lib.mineconfiguration.bukkit.value;
import cc.carm.lib.configuration.core.source.ConfigurationProvider;
import cc.carm.lib.mineconfiguration.bukkit.CraftConfigValue;
import cc.carm.lib.mineconfiguration.bukkit.builder.message.CraftMessageValueBuilder;
import cc.carm.lib.mineconfiguration.bukkit.data.TextConfig;
import cc.carm.lib.mineconfiguration.common.value.ConfigMessage;
import cc.carm.lib.configuration.core.source.ConfigurationProvider;
import cc.carm.lib.mineconfiguration.bukkit.builder.message.CraftMessageValueBuilder;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.function.BiConsumer;
import java.util.function.BiFunction;
@@ -43,10 +44,11 @@ public class ConfiguredMessage<M> extends ConfigMessage<M, TextConfig, CommandSe
}
@Override
public void broadcast(@NotNull Map<String, Object> placeholders) {
Bukkit.getOnlinePlayers().forEach(pl -> send(pl, placeholders));
send(Bukkit.getConsoleSender(), placeholders);
public @NotNull Collection<CommandSender> getAllReceivers() {
List<CommandSender> senders = new ArrayList<>();
senders.add(Bukkit.getConsoleSender());
senders.addAll(Bukkit.getOnlinePlayers());
return senders;
}
}
@@ -1,17 +1,18 @@
package cc.carm.lib.mineconfiguration.bukkit.value;
import cc.carm.lib.configuration.core.source.ConfigurationProvider;
import cc.carm.lib.mineconfiguration.bukkit.CraftConfigValue;
import cc.carm.lib.mineconfiguration.bukkit.builder.message.CraftMessageListBuilder;
import cc.carm.lib.mineconfiguration.bukkit.data.TextConfig;
import cc.carm.lib.mineconfiguration.common.value.ConfigMessageList;
import cc.carm.lib.configuration.core.source.ConfigurationProvider;
import cc.carm.lib.mineconfiguration.bukkit.builder.message.CraftMessageListBuilder;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.function.BiConsumer;
import java.util.function.BiFunction;
@@ -38,9 +39,11 @@ public class ConfiguredMessageList<M> extends ConfigMessageList<M, TextConfig, C
super(provider, sectionPath, headerComments, inlineComments, TextConfig.class, messages, params, messageParser, sendFunction, TextConfig::of);
}
public void broadcast(@NotNull Map<String, Object> placeholders) {
Bukkit.getOnlinePlayers().forEach(pl -> send(pl, placeholders));
send(Bukkit.getConsoleSender(), placeholders);
@Override
public @NotNull Collection<CommandSender> getAllReceivers() {
List<CommandSender> senders = new ArrayList<>();
senders.add(Bukkit.getConsoleSender());
senders.addAll(Bukkit.getOnlinePlayers());
return senders;
}
}
@@ -1,14 +1,14 @@
package cc.carm.lib.mineconfiguration.bukkit.value;
import cc.carm.lib.mineconfiguration.bukkit.CraftConfigValue;
import cc.carm.lib.mineconfiguration.bukkit.data.TitleConfig;
import cc.carm.lib.mineconfiguration.common.utils.ParamsUtils;
import cc.carm.lib.configuration.core.function.ConfigValueParser;
import cc.carm.lib.configuration.core.source.ConfigurationProvider;
import cc.carm.lib.configuration.core.source.ConfigurationWrapper;
import cc.carm.lib.configuration.core.value.type.ConfiguredSection;
import cc.carm.lib.mineconfiguration.bukkit.CraftConfigValue;
import cc.carm.lib.mineconfiguration.bukkit.builder.title.TitleConfigBuilder;
import cc.carm.lib.mineconfiguration.bukkit.data.TitleConfig;
import cc.carm.lib.mineconfiguration.bukkit.function.TitleSendConsumer;
import cc.carm.lib.mineconfiguration.common.utils.ParamsUtils;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
@@ -87,15 +87,15 @@ public class ConfiguredTitle extends ConfiguredSection<TitleConfig> {
}
}
public void sendAll(Object... values) {
sendAll(this.params, values);
public void sendToAll(Object... values) {
sendToAll(this.params, values);
}
public void sendAll(@NotNull String[] params, @NotNull Object[] values) {
sendAll(ParamsUtils.buildParams(params, values));
public void sendToAll(@NotNull String[] params, @NotNull Object[] values) {
sendToAll(ParamsUtils.buildParams(params, values));
}
public void sendAll(@NotNull Map<String, Object> placeholders) {
public void sendToAll(@NotNull Map<String, Object> placeholders) {
TitleConfig config = get();
if (config == null) return;
@@ -103,7 +103,7 @@ public class ConfiguredTitle extends ConfiguredSection<TitleConfig> {
}
public static ConfigValueParser<ConfigurationWrapper, TitleConfig> getTitleParser() {
public static ConfigValueParser<ConfigurationWrapper<?>, TitleConfig> getTitleParser() {
return (s, d) -> TitleConfig.deserialize(s);
}
}
+7 -11
View File
@@ -5,25 +5,28 @@
<parent>
<artifactId>mineconfiguration-parent</artifactId>
<groupId>cc.carm.lib</groupId>
<version>2.0.0</version>
<version>2.4.0</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>mineconfiguration-bungee</artifactId>
<packaging>jar</packaging>
<name>MineConfiguration-Bungee</name>
<description>轻松(做)配置,适用于BungeeCord的版本,可用JSON与YAML格式。</description>
<dependencies>
<dependency>
<groupId>${project.parent.groupId}</groupId>
<artifactId>easyconfiguration-core</artifactId>
<version>${easyconfiguration.version}</version>
<artifactId>mineconfiguration-common</artifactId>
<version>${project.parent.version}</version>
<scope>compile</scope>
</dependency>
@@ -43,13 +46,6 @@
<scope>provided</scope>
</dependency>
<dependency>
<groupId>${project.parent.groupId}</groupId>
<artifactId>mineconfiguration-common</artifactId>
<version>${project.parent.version}</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
@@ -1,14 +1,15 @@
package cc.carm.lib.mineconfiguration.bungee.builder.message;
import cc.carm.lib.easyplugin.utils.ColorParser;
import cc.carm.lib.mineconfiguration.bungee.data.MessageText;
import cc.carm.lib.mineconfiguration.common.builder.message.MessageConfigBuilder;
import cc.carm.lib.mineconfiguration.common.utils.ColorParser;
import net.md_5.bungee.api.CommandSender;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.function.BiFunction;
@SuppressWarnings("deprecation")
public class BungeeMessageBuilder extends MessageConfigBuilder<CommandSender, MessageText> {
@@ -1,13 +1,13 @@
package cc.carm.lib.mineconfiguration.bungee.source;
import cc.carm.lib.configuration.core.ConfigInitializer;
import cc.carm.lib.configuration.core.source.ConfigurationComments;
import cc.carm.lib.configuration.core.source.impl.FileConfigProvider;
import net.md_5.bungee.config.Configuration;
import net.md_5.bungee.config.ConfigurationProvider;
import net.md_5.bungee.config.YamlConfiguration;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.Unmodifiable;
import java.io.BufferedWriter;
import java.io.File;
@@ -16,7 +16,6 @@ import java.io.StringWriter;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
public class BungeeConfigProvider extends FileConfigProvider<BungeeSectionWrapper> {
@@ -52,6 +51,11 @@ public class BungeeConfigProvider extends FileConfigProvider<BungeeSectionWrappe
this.configuration = getLoader().load(file);
}
@Override
public @Nullable ConfigurationComments getComments() {
return this.comments;
}
@Override
public void save() throws Exception {
getLoader().save(configuration, file);
@@ -67,26 +71,6 @@ public class BungeeConfigProvider extends FileConfigProvider<BungeeSectionWrappe
}
}
@Override
public void setHeaderComment(@Nullable String path, @Nullable List<String> comments) {
this.comments.setHeaderComments(path, comments);
}
@Override
public void setInlineComment(@NotNull String path, @Nullable String comment) {
this.comments.setInlineComment(path, comment);
}
@Override
public @Nullable @Unmodifiable List<String> getHeaderComment(@Nullable String path) {
return this.comments.getHeaderComment(path);
}
@Override
public @Nullable String getInlineComment(@NotNull String path) {
return this.comments.getInlineComment(path);
}
@Override
public @NotNull ConfigInitializer<BungeeConfigProvider> getInitializer() {
return this.initializer;
@@ -11,12 +11,12 @@ import java.util.stream.Collectors;
import static cc.carm.lib.mineconfiguration.bungee.source.BungeeConfigProvider.SEPARATOR;
public class BungeeSectionWrapper implements ConfigurationWrapper {
public class BungeeSectionWrapper implements ConfigurationWrapper<Configuration> {
private final Configuration section;
private final Configuration configuration;
private BungeeSectionWrapper(@NotNull Configuration section) {
this.section = section;
this.configuration = section;
}
@Contract("!null->!null")
@@ -37,34 +37,39 @@ public class BungeeSectionWrapper implements ConfigurationWrapper {
return keys;
}
@Override
public @NotNull Configuration getSource() {
return this.configuration;
}
@Override
public @NotNull Set<String> getKeys(boolean deep) {
if (deep) {
return new LinkedHashSet<>(getAllKeys(section));
return new LinkedHashSet<>(getAllKeys(configuration));
} else {
return new LinkedHashSet<>(section.getKeys());
return new LinkedHashSet<>(configuration.getKeys());
}
}
@Override
public @NotNull Map<String, Object> getValues(boolean deep) {
return getKeys(deep).stream()
.collect(Collectors.toMap(key -> key, section::get, (a, b) -> b, LinkedHashMap::new));
.collect(Collectors.toMap(key -> key, configuration::get, (a, b) -> b, LinkedHashMap::new));
}
@Override
public void set(@NotNull String path, @Nullable Object value) {
this.section.set(path, value);
this.configuration.set(path, value);
}
@Override
public boolean contains(@NotNull String path) {
return this.section.contains(path);
return this.configuration.contains(path);
}
@Override
public @Nullable Object get(@NotNull String path) {
return this.section.get(path);
return this.configuration.get(path);
}
@Override
@@ -74,7 +79,7 @@ public class BungeeSectionWrapper implements ConfigurationWrapper {
@Override
public @Nullable List<?> getList(@NotNull String path) {
return this.section.getList(path);
return this.configuration.getList(path);
}
@Override
@@ -83,7 +88,7 @@ public class BungeeSectionWrapper implements ConfigurationWrapper {
}
@Override
public @Nullable ConfigurationWrapper getConfigurationSection(@NotNull String path) {
return of(this.section.getSection(path));
public @Nullable BungeeSectionWrapper getConfigurationSection(@NotNull String path) {
return of(this.configuration.getSection(path));
}
}
@@ -1,60 +1,23 @@
package cc.carm.lib.mineconfiguration.bungee.source;
import cc.carm.lib.configuration.core.source.ConfigurationComments;
import net.md_5.bungee.config.Configuration;
import net.md_5.bungee.config.ConfigurationProvider;
import net.md_5.bungee.config.YamlConfiguration;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.Unmodifiable;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.StringWriter;
import java.util.*;
import java.util.List;
import java.util.StringJoiner;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import static cc.carm.lib.mineconfiguration.bungee.source.BungeeConfigProvider.SEPARATOR;
public class BungeeYAMLComments {
protected final @NotNull Map<String, List<String>> headerComments = new HashMap<>();
protected final @NotNull Map<String, String> inlineComments = new HashMap<>();
protected @NotNull Map<String, List<String>> getHeaderComments() {
return headerComments;
}
protected @NotNull Map<String, String> getInlineComments() {
return inlineComments;
}
public void setHeaderComments(@Nullable String path, @Nullable List<String> comments) {
if (comments == null) {
getHeaderComments().remove(path);
} else {
getHeaderComments().put(path, comments);
}
}
public void setInlineComment(@NotNull String path, @Nullable String comment) {
if (comment == null) {
getInlineComments().remove(path);
} else {
getInlineComments().put(path, comment);
}
}
@Nullable
@Unmodifiable
public List<String> getHeaderComment(@Nullable String path) {
return Optional.ofNullable(getHeaderComments().get(path)).map(Collections::unmodifiableList).orElse(null);
}
public @Nullable String getInlineComment(@NotNull String path) {
return getInlineComments().get(path);
}
public class BungeeYAMLComments extends ConfigurationComments {
public @Nullable String buildHeaderComments(@Nullable String path, @NotNull String indents) {
List<String> comments = getHeaderComment(path);
@@ -144,7 +107,7 @@ public class BungeeYAMLComments {
* @param key 键
* @return 该键的缩进文本
*/
protected static String getIndents(String key) {
protected static String getIndents(@NotNull String key) {
String[] splitKey = key.split("[" + SEPARATOR + "]");
return IntStream.range(1, splitKey.length).mapToObj(i -> " ").collect(Collectors.joining());
}
@@ -1,17 +1,18 @@
package cc.carm.lib.mineconfiguration.bungee.value;
import cc.carm.lib.configuration.core.source.ConfigurationProvider;
import cc.carm.lib.mineconfiguration.bungee.BungeeConfigValue;
import cc.carm.lib.mineconfiguration.bungee.builder.message.BungeeMessageValueBuilder;
import cc.carm.lib.mineconfiguration.bungee.data.MessageText;
import cc.carm.lib.mineconfiguration.common.value.ConfigMessage;
import cc.carm.lib.configuration.core.source.ConfigurationProvider;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.ProxyServer;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.function.BiConsumer;
import java.util.function.BiFunction;
@@ -43,9 +44,11 @@ public class ConfiguredMessage<M> extends ConfigMessage<M, MessageText, CommandS
}
@Override
public void broadcast(@NotNull Map<String, Object> placeholders) {
ProxyServer.getInstance().getPlayers().forEach(pl -> send(pl, placeholders));
send(ProxyServer.getInstance().getConsole(), placeholders);
public @NotNull Collection<CommandSender> getAllReceivers() {
List<CommandSender> senders = new ArrayList<>();
senders.add(ProxyServer.getInstance().getConsole());
senders.addAll(ProxyServer.getInstance().getPlayers());
return senders;
}
@@ -10,6 +10,8 @@ import net.md_5.bungee.api.ProxyServer;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.function.BiConsumer;
@@ -38,9 +40,11 @@ public class ConfiguredMessageList<M> extends ConfigMessageList<M, MessageText,
super(provider, sectionPath, headerComments, inlineComments, MessageText.class, messages, params, messageParser, sendFunction, MessageText::of);
}
public void broadcast(@NotNull Map<String, Object> placeholders) {
ProxyServer.getInstance().getPlayers().forEach(pl -> send(pl, placeholders));
send(ProxyServer.getInstance().getConsole(), placeholders);
@Override
public @NotNull Collection<CommandSender> getAllReceivers() {
List<CommandSender> senders = new ArrayList<>();
senders.add(ProxyServer.getInstance().getConsole());
senders.addAll(ProxyServer.getInstance().getPlayers());
return senders;
}
}
-65
View File
@@ -1,65 +0,0 @@
<?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>
<groupId>cc.carm.lib</groupId>
<artifactId>mineconfiguration-parent</artifactId>
<version>2.0.0</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>
</properties>
<artifactId>mineconfiguration-spigot</artifactId>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>${project.parent.groupId}</groupId>
<artifactId>mineconfiguration-bukkit-base</artifactId>
<version>${project.parent.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.18.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<!--PlaceholderAPI for general placeholder's support-->
<dependency>
<groupId>me.clip</groupId>
<artifactId>placeholderapi</artifactId>
<version>2.11.1</version>
<scope>provided</scope>
</dependency>
<!--ProtocolLib for general packet's function support-->
<dependency>
<groupId>com.comphenix.protocol</groupId>
<artifactId>ProtocolLib</artifactId>
<version>4.8.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
@@ -1,42 +0,0 @@
package cc.carm.lib.mineconfiguration.spigot;
import cc.carm.lib.mineconfiguration.spigot.source.SpigotConfigProvider;
import org.bukkit.plugin.Plugin;
import java.io.File;
import java.io.IOException;
public class MineConfiguration {
public static SpigotConfigProvider from(File file, String source) {
SpigotConfigProvider provider = new SpigotConfigProvider(file);
try {
provider.initializeFile(source);
provider.initializeConfig();
} catch (IOException e) {
e.printStackTrace();
}
return provider;
}
public static SpigotConfigProvider from(File file) {
return from(file, file.getName());
}
public static SpigotConfigProvider from(String fileName) {
return from(fileName, fileName);
}
public static SpigotConfigProvider from(String fileName, String source) {
return from(new File(fileName), source);
}
public static SpigotConfigProvider from(Plugin plugin, String fileName) {
return from(plugin, fileName, fileName);
}
public static SpigotConfigProvider from(Plugin plugin, String fileName, String source) {
return from(new File(plugin.getDataFolder(), fileName), source);
}
}
@@ -1,54 +0,0 @@
package cc.carm.lib.mineconfiguration.spigot.source;
import cc.carm.lib.configuration.core.ConfigInitializer;
import cc.carm.lib.mineconfiguration.bukkit.source.CraftConfigProvider;
import org.bukkit.configuration.file.YamlConfiguration;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.Unmodifiable;
import java.io.File;
import java.util.Collections;
import java.util.List;
public class SpigotConfigProvider extends CraftConfigProvider {
public SpigotConfigProvider(@NotNull File file) {
super(file);
}
@Override
public void initializeConfig() {
this.configuration = YamlConfiguration.loadConfiguration(file);
this.initializer = new ConfigInitializer<>(this);
}
@Override
public void setHeaderComment(@Nullable String path, @Nullable List<String> comments) {
if (path == null) {
this.configuration.options().setHeader(comments);
} else {
this.configuration.setComments(path, comments);
}
}
@Override
public void setInlineComment(@NotNull String path, @Nullable String comment) {
if (comment == null) {
this.configuration.setInlineComments(path, null);
} else {
this.configuration.setComments(path, Collections.singletonList(comment));
}
}
@Override
public @Nullable @Unmodifiable List<String> getHeaderComment(@Nullable String path) {
if (path == null) return Collections.unmodifiableList(this.configuration.options().getHeader());
else return this.configuration.getComments(path);
}
@Override
public @Nullable String getInlineComment(@NotNull String path) {
return String.join(" ", this.configuration.getInlineComments(path));
}
}
+20 -15
View File
@@ -10,18 +10,18 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.encoding>UTF-8</maven.compiler.encoding>
<easyconfiguration.version>3.1.0</easyconfiguration.version>
<deps.easyconfifuration.version>3.4.0</deps.easyconfifuration.version>
<deps.easyplugin.version>1.5.2</deps.easyplugin.version>
</properties>
<groupId>cc.carm.lib</groupId>
<artifactId>mineconfiguration-parent</artifactId>
<version>2.0.0</version>
<version>2.4.0</version>
<packaging>pom</packaging>
<modules>
<module>common</module>
<module>platform/bungee</module>
<module>platform/bukkit</module>
<module>platform/spigot</module>
</modules>
<name>MineConfiguration</name>
@@ -39,7 +39,7 @@
</developers>
<scm>
<connection>scm:git:git@github.com:CarmJos/Easy.MineConfiguration</connection>
<connection>scm:git:git@github.com:CarmJos/MineConfiguration</connection>
<developerConnection>scm:git:git@github.com:CarmJos/MineConfiguration.git</developerConnection>
<url>https://github.com/CarmJos/MineConfiguration</url>
<tag>HEAD</tag>
@@ -65,9 +65,13 @@
<repositories>
<repository>
<id>carm-repo</id>
<name>Carm's Repo</name>
<url>https://repo.carm.cc/repository/maven-public/</url>
<id>central</id>
<url>https://repo1.maven.org/maven2/</url>
</repository>
<repository>
<id>sonatype</id>
<url>https://s01.oss.sonatype.org/content/groups/public/</url>
</repository>
<repository>
@@ -76,13 +80,14 @@
</repository>
<repository>
<id>nexus</id>
<id>lumine</id>
<url>https://mvn.lumine.io/repository/maven-public/</url>
</repository>
<repository>
<id>central</id>
<url>https://repo1.maven.org/maven2/</url>
<id>carm-repo</id>
<name>Carm's Repo</name>
<url>https://repo.carm.cc/repository/maven-public/</url>
</repository>
</repositories>
@@ -103,7 +108,7 @@
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>23.0.0</version>
<version>24.0.0</version>
<scope>provided</scope>
</dependency>
@@ -167,7 +172,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.2</version>
<version>3.3.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -190,7 +195,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.4.0</version>
<version>3.5.0</version>
<configuration>
<classifier>javadoc</classifier>
<detectJavaApiLink>false</detectJavaApiLink>
@@ -219,7 +224,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.3.0</version>
<version>3.4.1</version>
<executions>
<execution>
<phase>package</phase>