mirror of
https://github.com/CarmJos/EasyPlugin.git
synced 2026-06-05 00:58:17 +08:00
Compare commits
53 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 043fb99591 | |||
| 67af1b0dd4 | |||
| 1293ce1c35 | |||
| 069e243aa2 | |||
| a598cd4051 | |||
| af1cb7ae69 | |||
| 2463e62391 | |||
| adba8d774c | |||
| b42968c9a7 | |||
| 47b97fb97b | |||
| 2d286301d3 | |||
| 061d2a5ac9 | |||
| b2c248e0ae | |||
| 6f95fb156d | |||
| 21db2f59a4 | |||
| 326434a760 | |||
| 1be0541740 | |||
| 869811dd3f | |||
| 5bcb02ddf1 | |||
| 85ffc66c61 | |||
| 000ef51afe | |||
| 1ada26a919 | |||
| 95d2921c02 | |||
| 6ec015308c | |||
| 3a3906352f | |||
| 6e52cdef7c | |||
| a186ff896c | |||
| 8b13d4358f | |||
| c6a7312e3a | |||
| 8c347525ca | |||
| 66cb00431e | |||
| ba8e2b2929 | |||
| ed505357f3 | |||
| 54939f0f14 | |||
| bc3dd32f85 | |||
| 22ee1a157a | |||
| 00f1ff20fa | |||
| 91136a506d | |||
| edb8e0849a | |||
| 4e6caae8c9 | |||
| dd592cb764 | |||
| 5784215209 | |||
| 0eb774f560 | |||
| 4e24a87f12 | |||
| 44357d401f | |||
| d758e460f8 | |||
| 2caa33eb76 | |||
| 9450ef79fc | |||
| 89a17264f2 | |||
| 7923de25fb | |||
| bc046c02e4 | |||
| 1d279a16a8 | |||
| 17b7c23c54 |
@@ -14,9 +14,9 @@ jobs:
|
|||||||
packages-deploy:
|
packages-deploy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v6
|
||||||
- name: "Set up JDK"
|
- name: "Set up JDK"
|
||||||
uses: actions/setup-java@v2
|
uses: actions/setup-java@v5
|
||||||
with:
|
with:
|
||||||
java-version: '8'
|
java-version: '8'
|
||||||
distribution: 'adopt'
|
distribution: 'adopt'
|
||||||
@@ -35,9 +35,9 @@ jobs:
|
|||||||
github-deploy:
|
github-deploy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v6
|
||||||
- name: "Set up JDK"
|
- name: "Set up JDK"
|
||||||
uses: actions/setup-java@v2
|
uses: actions/setup-java@v5
|
||||||
with:
|
with:
|
||||||
java-version: '8'
|
java-version: '8'
|
||||||
distribution: 'adopt'
|
distribution: 'adopt'
|
||||||
@@ -59,7 +59,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
rm -rf docs
|
rm -rf docs
|
||||||
mkdir -vp docs
|
mkdir -vp docs
|
||||||
cp -vrf target/site/apidocs/* docs/
|
cp -vrf target/reports/apidocs/* docs/
|
||||||
cp -vrf .documentation/javadoc/JAVADOC-README.md docs/README.md
|
cp -vrf .documentation/javadoc/JAVADOC-README.md docs/README.md
|
||||||
|
|
||||||
- name: "Generate Javadoc sitemap"
|
- name: "Generate Javadoc sitemap"
|
||||||
@@ -112,21 +112,21 @@ jobs:
|
|||||||
name: "Deploy Project (Central)"
|
name: "Deploy Project (Central)"
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v6
|
||||||
- name: "Set up JDK"
|
- name: "Set up JDK"
|
||||||
uses: actions/setup-java@v2
|
uses: actions/setup-java@v5
|
||||||
with:
|
with:
|
||||||
java-version: '11'
|
java-version: '8'
|
||||||
distribution: 'adopt'
|
distribution: 'adopt'
|
||||||
cache: maven
|
cache: maven
|
||||||
server-id: ossrh
|
server-id: central
|
||||||
server-username: MAVEN_USERNAME
|
server-username: MAVEN_USERNAME
|
||||||
server-password: MAVEN_PASSWORD
|
server-password: MAVEN_PASSWORD
|
||||||
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
|
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
|
||||||
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase
|
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase
|
||||||
|
|
||||||
- name: "Central Deploy"
|
- name: "Central Deploy"
|
||||||
run: mvn -B -Possrh deploy --file pom.xml -DskipTests
|
run: mvn -B -Pcentral deploy --file pom.xml -DskipTests
|
||||||
env:
|
env:
|
||||||
MAVEN_USERNAME: ${{ secrets.OSSRH_USER }}
|
MAVEN_USERNAME: ${{ secrets.OSSRH_USER }}
|
||||||
MAVEN_PASSWORD: ${{ secrets.OSSRH_PASS }}
|
MAVEN_PASSWORD: ${{ secrets.OSSRH_PASS }}
|
||||||
|
|||||||
@@ -14,9 +14,9 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v6
|
||||||
- name: "Set up JDK"
|
- name: "Set up JDK"
|
||||||
uses: actions/setup-java@v2
|
uses: actions/setup-java@v5
|
||||||
with:
|
with:
|
||||||
cache: maven
|
cache: maven
|
||||||
java-version: '8'
|
java-version: '8'
|
||||||
|
|||||||
@@ -179,9 +179,6 @@ dependencies {
|
|||||||
若您觉得本插件做的不错,您可以通过捐赠支持我!
|
若您觉得本插件做的不错,您可以通过捐赠支持我!
|
||||||
|
|
||||||
感谢您对开源项目的支持!
|
感谢您对开源项目的支持!
|
||||||
|
|
||||||
<img height=25% width=25% src="https://raw.githubusercontent.com/CarmJos/CarmJos/main/img/donate-code.jpg" alt=""/>
|
|
||||||
|
|
||||||
## 开源协议
|
## 开源协议
|
||||||
|
|
||||||
本项目源码采用 [The MIT License](https://opensource.org/licenses/MIT) 开源协议。
|
本项目源码采用 [The MIT License](https://opensource.org/licenses/MIT) 开源协议。
|
||||||
@@ -201,4 +198,4 @@ dependencies {
|
|||||||
> MIT 协议是所有开源许可中最宽松的一个,除了必须包含许可声明外,再无任何限制。
|
> MIT 协议是所有开源许可中最宽松的一个,除了必须包含许可声明外,再无任何限制。
|
||||||
>
|
>
|
||||||
> *以上文字来自 [五种开源协议GPL,LGPL,BSD,MIT,Apache](https://www.oschina.net/question/54100_9455) 。*
|
> *以上文字来自 [五种开源协议GPL,LGPL,BSD,MIT,Apache](https://www.oschina.net/question/54100_9455) 。*
|
||||||
</details>
|
</details>
|
||||||
|
|||||||
+1
-1
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>cc.carm.lib</groupId>
|
<groupId>cc.carm.lib</groupId>
|
||||||
<artifactId>easyplugin-parent</artifactId>
|
<artifactId>easyplugin-parent</artifactId>
|
||||||
<version>1.5.11</version>
|
<version>1.5.14</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<properties>
|
<properties>
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public class ColorParser {
|
|||||||
public static @NotNull String clear(@NotNull String text) {
|
public static @NotNull String clear(@NotNull String text) {
|
||||||
text = HEX_PATTERN.matcher(text).replaceAll("");
|
text = HEX_PATTERN.matcher(text).replaceAll("");
|
||||||
text = GRADIENT_PATTERN.matcher(text).replaceAll("");
|
text = GRADIENT_PATTERN.matcher(text).replaceAll("");
|
||||||
text = COLOR_PATTERN.matcher(text).replaceAll("");
|
text = FORMAT_PATTERN.matcher(text).replaceAll("");
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,32 +19,7 @@ public class ColorParseTest {
|
|||||||
System.out.println(parse("&<#AAAAAA>&l我&r真&(#666666)的&<#BBBBBB>&o爱死&<#111111>你&<#FFFFFF>了&r!"));
|
System.out.println(parse("&<#AAAAAA>&l我&r真&(#666666)的&<#BBBBBB>&o爱死&<#111111>你&<#FFFFFF>了&r!"));
|
||||||
System.out.println(parse("&r正常的颜色理应&c&l不受影响&r。"));
|
System.out.println(parse("&r正常的颜色理应&c&l不受影响&r。"));
|
||||||
|
|
||||||
System.out.println(clear("&f测试&<#AAAAAA>清理颜色代码&<#111111> &&这样应该&(#666666)不被影响 &f。"));
|
System.out.println(clear("&f&l测试&<#AAAAAA>清理颜色代码&<#111111> &&这样应该&(#666666)不被影响 &f。"));
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void formatReadTest() {
|
|
||||||
LinkedHashMap<Integer, String> formats = new LinkedHashMap<>();
|
|
||||||
String text = "&k&l &m&1我&k爱你爱你爱你&o吗?";
|
|
||||||
Matcher matcher = ColorParser.FORMAT_PATTERN.matcher(text);
|
|
||||||
while (matcher.find()) {
|
|
||||||
String code = matcher.group();
|
|
||||||
formats.put(matcher.start(), code);
|
|
||||||
text = matcher.replaceFirst("");
|
|
||||||
matcher.reset(text);
|
|
||||||
}
|
|
||||||
|
|
||||||
formats.forEach((index, code) -> System.out.println(index + " -> " + code));
|
|
||||||
|
|
||||||
String[] parts = text.split("");
|
|
||||||
StringBuilder builder = new StringBuilder();
|
|
||||||
for (int i = 0; i < parts.length; i++) {
|
|
||||||
String format = formats.get(i);
|
|
||||||
if (format != null) builder.append(ColorParser.parseBaseColor(format));
|
|
||||||
builder.append(parts[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
System.out.println(builder);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>cc.carm.lib</groupId>
|
<groupId>cc.carm.lib</groupId>
|
||||||
<artifactId>easyplugin-parent</artifactId>
|
<artifactId>easyplugin-parent</artifactId>
|
||||||
<version>1.5.11</version>
|
<version>1.5.14</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<properties>
|
<properties>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>easyplugin-parent</artifactId>
|
<artifactId>easyplugin-parent</artifactId>
|
||||||
<groupId>cc.carm.lib</groupId>
|
<groupId>cc.carm.lib</groupId>
|
||||||
<version>1.5.11</version>
|
<version>1.5.14</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
+1
-1
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>easyplugin-parent</artifactId>
|
<artifactId>easyplugin-parent</artifactId>
|
||||||
<groupId>cc.carm.lib</groupId>
|
<groupId>cc.carm.lib</groupId>
|
||||||
<version>1.5.11</version>
|
<version>1.5.14</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -81,6 +81,19 @@ public class GUI {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置GUI上方(箱子部分)
|
||||||
|
* @param row 行数,1为第1行
|
||||||
|
* @param column 列数,1为第1列
|
||||||
|
* @param item GUIItem
|
||||||
|
*/
|
||||||
|
public void setItem(int row, int column, @NotNull GUIItem item){
|
||||||
|
if(row <= 0 || column <= 0) throw new IllegalArgumentException("行数和列数都不能小于等于零");
|
||||||
|
if(row > type.getLines()) throw new IllegalArgumentException("行数("+row+")大于GUI大小限制("+type.getLines()+")");
|
||||||
|
if(column > 9) throw new IllegalArgumentException("列数("+column+")不能大于9");
|
||||||
|
setItem(9*(row-1)+column-1, item);
|
||||||
|
}
|
||||||
|
|
||||||
public GUIItem getItem(int index) {
|
public GUIItem getItem(int index) {
|
||||||
return this.items.get(index);
|
return this.items.get(index);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import org.bukkit.event.HandlerList;
|
|||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
import org.bukkit.event.inventory.InventoryCloseEvent;
|
import org.bukkit.event.inventory.InventoryCloseEvent;
|
||||||
|
import org.bukkit.event.inventory.InventoryCreativeEvent;
|
||||||
import org.bukkit.event.inventory.InventoryDragEvent;
|
import org.bukkit.event.inventory.InventoryDragEvent;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
|
|
||||||
|
|||||||
@@ -77,7 +77,14 @@ public class AutoPagedGUI extends CommonPagedGUI {
|
|||||||
public void openGUI(Player user) {
|
public void openGUI(Player user) {
|
||||||
if (previousPageSlot >= 0) {
|
if (previousPageSlot >= 0) {
|
||||||
if (hasPreviousPage()) {
|
if (hasPreviousPage()) {
|
||||||
setItem(previousPageSlot, new GUIItem(Optional.ofNullable(defaultPreviousPage).map(d -> d.apply(user)).orElse(previousPageUI)) {
|
ItemStack finalPreviousPageUI;
|
||||||
|
if(previousPageUI != null)
|
||||||
|
finalPreviousPageUI = previousPageUI;
|
||||||
|
else if (defaultPreviousPage != null)
|
||||||
|
finalPreviousPageUI = defaultPreviousPage.apply(user);
|
||||||
|
else
|
||||||
|
finalPreviousPageUI = null;
|
||||||
|
setItem(previousPageSlot, new GUIItem(finalPreviousPageUI) {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(Player clicker, ClickType type) {
|
public void onClick(Player clicker, ClickType type) {
|
||||||
if (type == ClickType.RIGHT) {
|
if (type == ClickType.RIGHT) {
|
||||||
@@ -95,7 +102,14 @@ public class AutoPagedGUI extends CommonPagedGUI {
|
|||||||
|
|
||||||
if (nextPageSlot >= 0) {
|
if (nextPageSlot >= 0) {
|
||||||
if (hasNextPage()) {
|
if (hasNextPage()) {
|
||||||
setItem(nextPageSlot, new GUIItem(Optional.ofNullable(defaultNextPage).map(d -> d.apply(user)).orElse(nextPageUI)) {
|
ItemStack finalNextPageUI;
|
||||||
|
if(previousPageUI != null)
|
||||||
|
finalNextPageUI = nextPageUI;
|
||||||
|
else if (defaultNextPage != null)
|
||||||
|
finalNextPageUI = defaultNextPage.apply(user);
|
||||||
|
else
|
||||||
|
finalNextPageUI = null;
|
||||||
|
setItem(nextPageSlot, new GUIItem(finalNextPageUI) {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(Player clicker, ClickType type) {
|
public void onClick(Player clicker, ClickType type) {
|
||||||
if (type == ClickType.RIGHT) {
|
if (type == ClickType.RIGHT) {
|
||||||
|
|||||||
@@ -101,6 +101,8 @@ public class CommonPagedGUI extends PagedGUI {
|
|||||||
super.openGUI(player);
|
super.openGUI(player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if(page > getLastPageNumber())
|
||||||
|
page = getLastPageNumber();
|
||||||
List<GUIItem> list = new ArrayList<>();
|
List<GUIItem> list = new ArrayList<>();
|
||||||
int start = (page - 1) * range.length;
|
int start = (page - 1) * range.length;
|
||||||
for (int i = start; i < start + range.length; i++) {
|
for (int i = start; i < start + range.length; i++) {
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public abstract class PagedGUI extends GUI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int setCurrentPage(int page) {
|
public int setCurrentPage(int page) {
|
||||||
this.page = Math.max(1, Math.min(page, getLastPageNumber()));
|
this.page = Math.max(1, page);
|
||||||
return this.page;
|
return this.page;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
public class PageTest {
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test() {
|
||||||
|
System.out.println(maxPage(0, 10));
|
||||||
|
System.out.println(maxPage(10, 10));
|
||||||
|
System.out.println(maxPage(5, 10));
|
||||||
|
System.out.println(maxPage(15, 10));
|
||||||
|
System.out.println(maxPage(19, 10));
|
||||||
|
System.out.println(maxPage(20, 10));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
int maxPage(int contents, int size) {
|
||||||
|
if (contents == 0 || size == 0) return 1;
|
||||||
|
return (contents / size) + ((contents % size) == 0 ? 0 : 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
-1
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>easyplugin-parent</artifactId>
|
<artifactId>easyplugin-parent</artifactId>
|
||||||
<groupId>cc.carm.lib</groupId>
|
<groupId>cc.carm.lib</groupId>
|
||||||
<version>1.5.11</version>
|
<version>1.5.14</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>cc.carm.lib</groupId>
|
<groupId>cc.carm.lib</groupId>
|
||||||
<artifactId>easyplugin-parent</artifactId>
|
<artifactId>easyplugin-parent</artifactId>
|
||||||
<version>1.5.11</version>
|
<version>1.5.14</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<properties>
|
<properties>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>easyplugin-parent</artifactId>
|
<artifactId>easyplugin-parent</artifactId>
|
||||||
<groupId>cc.carm.lib</groupId>
|
<groupId>cc.carm.lib</groupId>
|
||||||
<version>1.5.11</version>
|
<version>1.5.14</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
+1
-1
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>cc.carm.lib</groupId>
|
<groupId>cc.carm.lib</groupId>
|
||||||
<artifactId>easyplugin-parent</artifactId>
|
<artifactId>easyplugin-parent</artifactId>
|
||||||
<version>1.5.11</version>
|
<version>1.5.14</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<properties>
|
<properties>
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
package cc.carm.lib.easyplugin.user;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
public abstract class AbstractUserData<K> implements UserData<K> {
|
||||||
|
|
||||||
|
protected final @NotNull K key;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to mark the data as dropping (save and unload) status.
|
||||||
|
*/
|
||||||
|
protected boolean dropping = false;
|
||||||
|
|
||||||
|
protected AbstractUserData(@NotNull K key) {
|
||||||
|
this.key = key;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull K key() {
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param dropping true if the data is dropping, false otherwise
|
||||||
|
*/
|
||||||
|
public void setDropping(boolean dropping) {
|
||||||
|
this.dropping = dropping;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return true if the data is dropping, false otherwise
|
||||||
|
*/
|
||||||
|
public boolean isDropping() {
|
||||||
|
return dropping;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) return true;
|
||||||
|
if (o == null || getClass() != o.getClass()) return false;
|
||||||
|
AbstractUserData<?> abstractUserData = (AbstractUserData<?>) o;
|
||||||
|
return key.equals(abstractUserData.key);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -2,31 +2,17 @@ package cc.carm.lib.easyplugin.user;
|
|||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.Objects;
|
public interface UserData<K> {
|
||||||
|
|
||||||
public abstract class UserData<K> {
|
@NotNull K key();
|
||||||
|
|
||||||
protected final @NotNull K key;
|
/**
|
||||||
|
* @param dropping true if the data is dropping, false otherwise
|
||||||
protected UserData(@NotNull K key) {
|
*/
|
||||||
this.key = key;
|
void setDropping(boolean dropping);
|
||||||
}
|
|
||||||
|
|
||||||
public @NotNull K getKey() {
|
|
||||||
return key;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object o) {
|
|
||||||
if (this == o) return true;
|
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
|
||||||
UserData<?> userData = (UserData<?>) o;
|
|
||||||
return key.equals(userData.key);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return Objects.hash(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return true if the data is dropping, false otherwise
|
||||||
|
*/
|
||||||
|
boolean isDropping();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,12 @@
|
|||||||
package cc.carm.lib.easyplugin.user;
|
package cc.carm.lib.easyplugin.user;
|
||||||
|
|
||||||
import cc.carm.lib.easyplugin.EasyPlugin;
|
import cc.carm.lib.easyplugin.EasyPlugin;
|
||||||
import com.google.common.collect.ImmutableSet;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.OfflinePlayer;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.jetbrains.annotations.Unmodifiable;
|
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
@@ -21,7 +18,7 @@ import java.util.function.Supplier;
|
|||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public abstract class UserDataManager<K, U extends UserData<K>> {
|
public abstract class UserDataManager<K, U extends AbstractUserData<K>> implements UserDataRegistry<K, U> {
|
||||||
|
|
||||||
protected final @NotNull EasyPlugin plugin;
|
protected final @NotNull EasyPlugin plugin;
|
||||||
|
|
||||||
@@ -47,6 +44,7 @@ public abstract class UserDataManager<K, U extends UserData<K>> {
|
|||||||
this.dataCache = cacheMap;
|
this.dataCache = cacheMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void shutdown() {
|
public void shutdown() {
|
||||||
this.executor.shutdown();
|
this.executor.shutdown();
|
||||||
}
|
}
|
||||||
@@ -55,14 +53,11 @@ public abstract class UserDataManager<K, U extends UserData<K>> {
|
|||||||
return plugin;
|
return plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected @NotNull Logger getLogger() {
|
@Override
|
||||||
|
public @NotNull Logger getLogger() {
|
||||||
return getPlugin().getLogger();
|
return getPlugin().getLogger();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String serializeKey(@NotNull K key) {
|
|
||||||
return key.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract @NotNull U emptyUser(@NotNull K key);
|
public abstract @NotNull U emptyUser(@NotNull K key);
|
||||||
|
|
||||||
public @NotNull U errorUser(@NotNull K key) {
|
public @NotNull U errorUser(@NotNull K key) {
|
||||||
@@ -73,36 +68,17 @@ public abstract class UserDataManager<K, U extends UserData<K>> {
|
|||||||
|
|
||||||
protected abstract void saveData(@NotNull U data) throws Exception;
|
protected abstract void saveData(@NotNull U data) throws Exception;
|
||||||
|
|
||||||
public @NotNull CompletableFuture<U> load(@NotNull K key) {
|
@Override
|
||||||
return load(key, false);
|
public @NotNull Map<K, U> cache() {
|
||||||
}
|
|
||||||
|
|
||||||
public @NotNull CompletableFuture<U> load(@NotNull K key, boolean cache) {
|
|
||||||
return load(key, () -> cache);
|
|
||||||
}
|
|
||||||
|
|
||||||
public @NotNull Map<K, U> getDataCache() {
|
|
||||||
return dataCache;
|
return dataCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Unmodifiable
|
@Override
|
||||||
public @NotNull Set<U> list() {
|
|
||||||
return ImmutableSet.copyOf(getDataCache().values());
|
|
||||||
}
|
|
||||||
|
|
||||||
public @NotNull U get(@NotNull K key) {
|
|
||||||
return Optional.ofNullable(getNullable(key)).orElseThrow(() -> new NullPointerException("User " + key + " not found."));
|
|
||||||
}
|
|
||||||
|
|
||||||
public @Nullable U getNullable(@NotNull K key) {
|
|
||||||
return getDataCache().get(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
public @NotNull Optional<@Nullable U> getOptional(@NotNull K key) {
|
|
||||||
return Optional.ofNullable(getNullable(key));
|
|
||||||
}
|
|
||||||
|
|
||||||
public @NotNull CompletableFuture<U> load(@NotNull K key, @NotNull Supplier<Boolean> cacheCondition) {
|
public @NotNull CompletableFuture<U> load(@NotNull K key, @NotNull Supplier<Boolean> cacheCondition) {
|
||||||
|
U cached = getNullable(key);
|
||||||
|
if (cached != null) {
|
||||||
|
return CompletableFuture.supplyAsync(() -> cached); // Return cached data async.
|
||||||
|
}
|
||||||
return CompletableFuture.supplyAsync(() -> {
|
return CompletableFuture.supplyAsync(() -> {
|
||||||
String identifier = serializeKey(key);
|
String identifier = serializeKey(key);
|
||||||
|
|
||||||
@@ -124,14 +100,15 @@ public abstract class UserDataManager<K, U extends UserData<K>> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}, executor).thenApply((data) -> {
|
}, executor).thenApply((data) -> {
|
||||||
if (cacheCondition.get()) dataCache.put(key, data);
|
if (cacheCondition.get() && !data.isDropping()) dataCache.put(key, data);
|
||||||
return data;
|
return data;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public @NotNull CompletableFuture<Boolean> save(@NotNull U user) {
|
public @NotNull CompletableFuture<Boolean> save(@NotNull U user) {
|
||||||
return CompletableFuture.supplyAsync(() -> {
|
return CompletableFuture.supplyAsync(() -> {
|
||||||
String identifier = serializeKey(user.getKey());
|
String identifier = serializeKey(user.key());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
long s1 = System.currentTimeMillis();
|
long s1 = System.currentTimeMillis();
|
||||||
@@ -148,17 +125,18 @@ public abstract class UserDataManager<K, U extends UserData<K>> {
|
|||||||
}, executor);
|
}, executor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public @NotNull CompletableFuture<Boolean> unload(@NotNull K key) {
|
@Override
|
||||||
return unload(key, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public @NotNull CompletableFuture<Boolean> unload(@NotNull K key, boolean save) {
|
public @NotNull CompletableFuture<Boolean> unload(@NotNull K key, boolean save) {
|
||||||
U data = getNullable(key);
|
U data = getNullable(key);
|
||||||
if (data == null) return CompletableFuture.completedFuture(false);
|
if (data == null) return CompletableFuture.completedFuture(false);
|
||||||
|
data.setDropping(true); // Mark the data as unloading.
|
||||||
if (save) {
|
if (save) {
|
||||||
return save(data).thenApply(result -> {
|
return save(data).thenApply(result -> {
|
||||||
this.dataCache.remove(key);
|
// Check if the data is still unloading,
|
||||||
|
// which cloud be interrupted by the next load.
|
||||||
|
if (data.isDropping()) {
|
||||||
|
this.dataCache.remove(key);
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@@ -168,6 +146,7 @@ public abstract class UserDataManager<K, U extends UserData<K>> {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public @NotNull CompletableFuture<Boolean> modify(@NotNull K key, @NotNull Consumer<U> consumer) {
|
public @NotNull CompletableFuture<Boolean> modify(@NotNull K key, @NotNull Consumer<U> consumer) {
|
||||||
U cached = getNullable(key);
|
U cached = getNullable(key);
|
||||||
if (cached != null) {
|
if (cached != null) {
|
||||||
@@ -176,13 +155,14 @@ public abstract class UserDataManager<K, U extends UserData<K>> {
|
|||||||
return true;
|
return true;
|
||||||
}, executor);
|
}, executor);
|
||||||
} else {
|
} else {
|
||||||
return load(key, false).thenApply((data) -> {
|
return load(key, true).thenApply((data) -> {
|
||||||
consumer.accept(data);
|
consumer.accept(data);
|
||||||
return data;
|
return data;
|
||||||
}).thenCompose(this::save);
|
}).thenCompose(data -> unload(key, true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public <V> @NotNull CompletableFuture<V> peek(@NotNull K key, @NotNull Function<U, V> function) {
|
public <V> @NotNull CompletableFuture<V> peek(@NotNull K key, @NotNull Function<U, V> function) {
|
||||||
U cached = getNullable(key);
|
U cached = getNullable(key);
|
||||||
if (cached != null) {
|
if (cached != null) {
|
||||||
@@ -192,10 +172,6 @@ public abstract class UserDataManager<K, U extends UserData<K>> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public @NotNull CompletableFuture<Map<K, U>> loadOnline(@NotNull Function<Player, ? extends K> function) {
|
|
||||||
return loadGroup(Bukkit.getOnlinePlayers(), function, OfflinePlayer::isOnline);
|
|
||||||
}
|
|
||||||
|
|
||||||
public <T> @NotNull CompletableFuture<Map<K, U>> loadGroup(@NotNull Collection<? extends T> users,
|
public <T> @NotNull CompletableFuture<Map<K, U>> loadGroup(@NotNull Collection<? extends T> users,
|
||||||
@NotNull Function<? super T, ? extends K> function,
|
@NotNull Function<? super T, ? extends K> function,
|
||||||
@NotNull Predicate<T> cacheCondition) {
|
@NotNull Predicate<T> cacheCondition) {
|
||||||
@@ -218,31 +194,24 @@ public abstract class UserDataManager<K, U extends UserData<K>> {
|
|||||||
return task.thenApply(Collections::unmodifiableMap);
|
return task.thenApply(Collections::unmodifiableMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
public @NotNull CompletableFuture<Map<K, U>> loadGroup(@NotNull Collection<K> allKeys,
|
@Override
|
||||||
@NotNull Predicate<K> cacheCondition) {
|
|
||||||
return loadGroup(allKeys, Function.identity(), cacheCondition);
|
|
||||||
}
|
|
||||||
|
|
||||||
public @NotNull CompletableFuture<Map<K, U>> loadGroup(@NotNull Collection<K> allKeys) {
|
|
||||||
return loadGroup(allKeys, (v) -> false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void saveAll() {
|
public void saveAll() {
|
||||||
if (getDataCache().isEmpty()) return;
|
if (cache().isEmpty()) return;
|
||||||
for (U u : getDataCache().values()) {
|
for (U u : cache().values()) {
|
||||||
try {
|
try {
|
||||||
saveData(u);
|
saveData(u);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
getPlugin().error("保存用户 " + serializeKey(u.getKey()) + " 数据失败,请检查相关配置!");
|
getPlugin().error("保存用户 " + serializeKey(u.key()) + " 数据失败,请检查相关配置!");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int unloadAll(boolean save) {
|
public int unloadAll(boolean save) {
|
||||||
if (save) saveAll();
|
if (save) saveAll();
|
||||||
int size = getDataCache().size();
|
int size = cache().size();
|
||||||
getDataCache().clear();
|
cache().clear();
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,93 @@
|
|||||||
|
package cc.carm.lib.easyplugin.user;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.OfflinePlayer;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
import org.jetbrains.annotations.Unmodifiable;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.function.Predicate;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
public interface UserDataRegistry<K, U extends UserData<K>> {
|
||||||
|
|
||||||
|
void shutdown();
|
||||||
|
|
||||||
|
@NotNull Logger getLogger();
|
||||||
|
|
||||||
|
@NotNull Map<K, U> cache();
|
||||||
|
|
||||||
|
default String serializeKey(@NotNull K key) {
|
||||||
|
return key.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
default @NotNull CompletableFuture<U> load(@NotNull K key) {
|
||||||
|
return load(key, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
default @NotNull CompletableFuture<U> load(@NotNull K key, boolean cache) {
|
||||||
|
return load(key, () -> cache);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Unmodifiable
|
||||||
|
default @NotNull Set<U> list() {
|
||||||
|
return ImmutableSet.copyOf(cache().values());
|
||||||
|
}
|
||||||
|
|
||||||
|
default @NotNull U get(@NotNull K key) {
|
||||||
|
return Optional.ofNullable(getNullable(key)).orElseThrow(() -> new NullPointerException("User " + key + " not found."));
|
||||||
|
}
|
||||||
|
|
||||||
|
default @Nullable U getNullable(@NotNull K key) {
|
||||||
|
return cache().get(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
default @NotNull Optional<@Nullable U> getOptional(@NotNull K key) {
|
||||||
|
return Optional.ofNullable(getNullable(key));
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull CompletableFuture<U> load(@NotNull K key, @NotNull Supplier<Boolean> cacheCondition);
|
||||||
|
|
||||||
|
@NotNull CompletableFuture<Boolean> save(@NotNull U user);
|
||||||
|
|
||||||
|
default @NotNull CompletableFuture<Boolean> unload(@NotNull K key) {
|
||||||
|
return unload(key, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull CompletableFuture<Boolean> unload(@NotNull K key, boolean save);
|
||||||
|
|
||||||
|
@NotNull CompletableFuture<Boolean> modify(@NotNull K key, @NotNull Consumer<U> consumer);
|
||||||
|
|
||||||
|
<V> @NotNull CompletableFuture<V> peek(@NotNull K key, @NotNull Function<U, V> function);
|
||||||
|
|
||||||
|
default @NotNull CompletableFuture<Map<K, U>> loadOnline(@NotNull Function<Player, ? extends K> function) {
|
||||||
|
return loadGroup(Bukkit.getOnlinePlayers(), function, OfflinePlayer::isOnline);
|
||||||
|
}
|
||||||
|
|
||||||
|
<T> @NotNull CompletableFuture<Map<K, U>> loadGroup(@NotNull Collection<? extends T> users,
|
||||||
|
@NotNull Function<? super T, ? extends K> function,
|
||||||
|
@NotNull Predicate<T> cacheCondition);
|
||||||
|
|
||||||
|
default @NotNull CompletableFuture<Map<K, U>> loadGroup(@NotNull Collection<K> allKeys,
|
||||||
|
@NotNull Predicate<K> cacheCondition) {
|
||||||
|
return loadGroup(allKeys, Function.identity(), cacheCondition);
|
||||||
|
}
|
||||||
|
|
||||||
|
default @NotNull CompletableFuture<Map<K, U>> loadGroup(@NotNull Collection<K> allKeys) {
|
||||||
|
return loadGroup(allKeys, (v) -> false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void saveAll();
|
||||||
|
|
||||||
|
int unloadAll(boolean save);
|
||||||
|
}
|
||||||
+1
-1
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>easyplugin-parent</artifactId>
|
<artifactId>easyplugin-parent</artifactId>
|
||||||
<groupId>cc.carm.lib</groupId>
|
<groupId>cc.carm.lib</groupId>
|
||||||
<version>1.5.11</version>
|
<version>1.5.14</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>easyplugin-parent</artifactId>
|
<artifactId>easyplugin-parent</artifactId>
|
||||||
<groupId>cc.carm.lib</groupId>
|
<groupId>cc.carm.lib</groupId>
|
||||||
<version>1.5.11</version>
|
<version>1.5.14</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>easyplugin-parent</artifactId>
|
<artifactId>easyplugin-parent</artifactId>
|
||||||
<groupId>cc.carm.lib</groupId>
|
<groupId>cc.carm.lib</groupId>
|
||||||
<version>1.5.11</version>
|
<version>1.5.14</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>easyplugin-parent</artifactId>
|
<artifactId>easyplugin-parent</artifactId>
|
||||||
<groupId>cc.carm.lib</groupId>
|
<groupId>cc.carm.lib</groupId>
|
||||||
<version>1.5.11</version>
|
<version>1.5.14</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>easyplugin-parent</artifactId>
|
<artifactId>easyplugin-parent</artifactId>
|
||||||
<groupId>cc.carm.lib</groupId>
|
<groupId>cc.carm.lib</groupId>
|
||||||
<version>1.5.11</version>
|
<version>1.5.14</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>easyplugin-parent</artifactId>
|
<artifactId>easyplugin-parent</artifactId>
|
||||||
<groupId>cc.carm.lib</groupId>
|
<groupId>cc.carm.lib</groupId>
|
||||||
<version>1.5.11</version>
|
<version>1.5.14</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>easyplugin-parent</artifactId>
|
<artifactId>easyplugin-parent</artifactId>
|
||||||
<groupId>cc.carm.lib</groupId>
|
<groupId>cc.carm.lib</groupId>
|
||||||
<version>1.5.11</version>
|
<version>1.5.14</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
<groupId>cc.carm.lib</groupId>
|
<groupId>cc.carm.lib</groupId>
|
||||||
<artifactId>easyplugin-parent</artifactId>
|
<artifactId>easyplugin-parent</artifactId>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<version>1.5.11</version>
|
<version>1.5.14</version>
|
||||||
<modules>
|
<modules>
|
||||||
<module>base/color</module>
|
<module>base/color</module>
|
||||||
<module>base/utils</module>
|
<module>base/utils</module>
|
||||||
@@ -117,14 +117,14 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.spigotmc</groupId>
|
<groupId>org.spigotmc</groupId>
|
||||||
<artifactId>spigot-api</artifactId>
|
<artifactId>spigot-api</artifactId>
|
||||||
<version>1.13.2-R0.1-SNAPSHOT</version>
|
<version>1.19-R0.1-20220725.090125-47</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jetbrains</groupId>
|
<groupId>org.jetbrains</groupId>
|
||||||
<artifactId>annotations</artifactId>
|
<artifactId>annotations</artifactId>
|
||||||
<version>23.0.0</version>
|
<version>26.1.0</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
@@ -142,12 +142,12 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>me.clip</groupId>
|
<groupId>me.clip</groupId>
|
||||||
<artifactId>placeholderapi</artifactId>
|
<artifactId>placeholderapi</artifactId>
|
||||||
<version>2.10.9</version>
|
<version>2.12.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.MilkBowl</groupId>
|
<groupId>com.github.MilkBowl</groupId>
|
||||||
<artifactId>VaultAPI</artifactId>
|
<artifactId>VaultAPI</artifactId>
|
||||||
<version>1.7</version>
|
<version>1.7.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cc.carm.lib</groupId>
|
<groupId>cc.carm.lib</groupId>
|
||||||
@@ -162,7 +162,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
<version>2.22.1</version>
|
<version>3.5.6</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<useSystemClassLoader>false</useSystemClassLoader>
|
<useSystemClassLoader>false</useSystemClassLoader>
|
||||||
</configuration>
|
</configuration>
|
||||||
@@ -170,7 +170,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>3.8.1</version>
|
<version>3.15.0</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>${project.jdk.version}</source>
|
<source>${project.jdk.version}</source>
|
||||||
<target>${project.jdk.version}</target>
|
<target>${project.jdk.version}</target>
|
||||||
@@ -181,12 +181,12 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-jar-plugin</artifactId>
|
<artifactId>maven-jar-plugin</artifactId>
|
||||||
<version>3.2.0</version>
|
<version>3.5.0</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-source-plugin</artifactId>
|
<artifactId>maven-source-plugin</artifactId>
|
||||||
<version>3.2.0</version>
|
<version>3.4.0</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<phase>package</phase>
|
<phase>package</phase>
|
||||||
@@ -203,7 +203,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-gpg-plugin</artifactId>
|
<artifactId>maven-gpg-plugin</artifactId>
|
||||||
<version>3.0.1</version>
|
<version>3.2.8</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<id>sign-artifacts</id>
|
<id>sign-artifacts</id>
|
||||||
@@ -223,7 +223,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-release-plugin</artifactId>
|
<artifactId>maven-release-plugin</artifactId>
|
||||||
<version>2.5.3</version>
|
<version>3.3.1</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<autoVersionSubmodules>true</autoVersionSubmodules>
|
<autoVersionSubmodules>true</autoVersionSubmodules>
|
||||||
<useReleaseProfile>false</useReleaseProfile>
|
<useReleaseProfile>false</useReleaseProfile>
|
||||||
@@ -237,7 +237,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-javadoc-plugin</artifactId>
|
<artifactId>maven-javadoc-plugin</artifactId>
|
||||||
<version>3.2.0</version>
|
<version>3.12.0</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<classifier>javadoc</classifier>
|
<classifier>javadoc</classifier>
|
||||||
<detectJavaApiLink>false</detectJavaApiLink>
|
<detectJavaApiLink>false</detectJavaApiLink>
|
||||||
@@ -258,7 +258,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-shade-plugin</artifactId>
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
<version>3.2.3</version>
|
<version>3.6.2</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<phase>package</phase>
|
<phase>package</phase>
|
||||||
@@ -296,17 +296,24 @@
|
|||||||
<profiles>
|
<profiles>
|
||||||
|
|
||||||
<profile>
|
<profile>
|
||||||
<id>ossrh</id>
|
<id>central</id>
|
||||||
<distributionManagement>
|
<build>
|
||||||
<snapshotRepository>
|
<plugins>
|
||||||
<id>ossrh</id>
|
<plugin>
|
||||||
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
|
<groupId>org.sonatype.central</groupId>
|
||||||
</snapshotRepository>
|
<artifactId>central-publishing-maven-plugin</artifactId>
|
||||||
<repository>
|
<version>0.10.0</version>
|
||||||
<id>ossrh</id>
|
<extensions>true</extensions>
|
||||||
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
|
<configuration>
|
||||||
</repository>
|
<publishingServerId>central</publishingServerId>
|
||||||
</distributionManagement>
|
<autoPublish>true</autoPublish>
|
||||||
|
<excludeArtifacts>
|
||||||
|
<excludeArtifact>configured-demo</excludeArtifact>
|
||||||
|
</excludeArtifacts>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
</profile>
|
</profile>
|
||||||
|
|
||||||
<profile>
|
<profile>
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||||
|
"extends": [
|
||||||
|
"config:recommended"
|
||||||
|
],
|
||||||
|
"packageRules": [
|
||||||
|
{
|
||||||
|
"matchUpdateTypes": ["minor", "patch"],
|
||||||
|
"matchCurrentVersion": "!/^0/",
|
||||||
|
"automerge": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user