mirror of
https://github.com/CarmJos/PlayerPrefix.git
synced 2026-06-04 18:08:18 +08:00
Compare commits
35 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d3ea1ef502 | |||
| 52df3fa4ae | |||
| f3ed09deec | |||
| 608e80434b | |||
| 2b0942d201 | |||
| f2a5ec546a | |||
| ca15918e52 | |||
| a4d7e0153f | |||
| f7e02a00b1 | |||
| 5a808b2b9f | |||
| f358987c4c | |||
| 94f8f86418 | |||
| 6a8a349ee3 | |||
| 91935882bd | |||
| 4a1382a452 | |||
| b2880c8fab | |||
| 3c05967d7e | |||
| 1aa5d2d3b5 | |||
| 0bbaf484e6 | |||
| 2d12a31764 | |||
| 20a02eff2b | |||
| e23e137a6e | |||
| 37e80b554b | |||
| f2a74e0d90 | |||
| 2c75cd5f0e | |||
| f8c61bc843 | |||
| 127617c4d0 | |||
| 2a024e2885 | |||
| 48e8fc7847 | |||
| c39836d439 | |||
| c081f02cb8 | |||
| 8d087d3abd | |||
| ff40d921e7 | |||
| ff0255f72a | |||
| 8d3e4f2853 |
@@ -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:
|
||||||
java-version: '11'
|
java-version: '11'
|
||||||
distribution: 'adopt'
|
distribution: 'adopt'
|
||||||
@@ -27,12 +27,12 @@ jobs:
|
|||||||
- name: "Package"
|
- name: "Package"
|
||||||
run: mvn -B package --file pom.xml
|
run: mvn -B package --file pom.xml
|
||||||
env:
|
env:
|
||||||
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
|
MAVEN_USERNAME: ${{ github.repository_owner }}
|
||||||
MAVEN_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
MAVEN_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
||||||
- name: "Target Stage"
|
- name: "Target Stage"
|
||||||
run: mkdir staging && cp target/*.jar staging
|
run: mkdir staging && cp target/*.jar staging
|
||||||
- name: "Upload artifact"
|
- name: "Upload artifact"
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v7
|
||||||
with:
|
with:
|
||||||
name: artifact
|
name: artifact
|
||||||
path: staging
|
path: staging
|
||||||
@@ -52,6 +52,13 @@
|
|||||||
- 设置目标玩家的前缀列表为源玩家的前缀列表
|
- 设置目标玩家的前缀列表为源玩家的前缀列表
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## 变量
|
||||||
|
|
||||||
|
```text
|
||||||
|
# %PlayerPrefix%
|
||||||
|
- 获取玩家当前的前缀内容。
|
||||||
|
```
|
||||||
|
|
||||||
## [玩家数据文件](https://github.com/CarmJos/PlayerPrefix/blob/master/example/userdata.yml) 示例
|
## [玩家数据文件](https://github.com/CarmJos/PlayerPrefix/blob/master/example/userdata.yml) 示例
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
|
|||||||
@@ -4,9 +4,9 @@
|
|||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<groupId>com.harmoland</groupId>
|
<groupId>cc.carm.plugin</groupId>
|
||||||
<artifactId>PlayerPrefix</artifactId>
|
<artifactId>playerprefix</artifactId>
|
||||||
<version>1.0.0</version>
|
<version>1.1.1</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
@@ -15,18 +15,18 @@
|
|||||||
<maven.compiler.target>1.8</maven.compiler.target>
|
<maven.compiler.target>1.8</maven.compiler.target>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<name>玩家前缀系统</name>
|
<name>PlayerPrefix</name>
|
||||||
<description>指令操作的轻量玩家前缀管理插件。</description>
|
<description>指令操作的轻量玩家前缀管理插件。</description>
|
||||||
<url>https://github.com/CarmJos/PlayerPrefix</url>
|
<url>https://github.com/CarmJos/PlayerPrefix</url>
|
||||||
|
|
||||||
<issueManagement>
|
<issueManagement>
|
||||||
<system>GitHub Issues</system>
|
<system>GitHub Issues</system>
|
||||||
<url>https://github.com/CarmJos/PlayerPrefix/issues</url>
|
<url>${project.url}/issues</url>
|
||||||
</issueManagement>
|
</issueManagement>
|
||||||
|
|
||||||
<ciManagement>
|
<ciManagement>
|
||||||
<system>GitHub Actions</system>
|
<system>GitHub Actions</system>
|
||||||
<url>https://github.com/CarmJos/PlayerPrefix/actions/workflows/maven.yml</url>
|
<url>${project.url}/actions/workflows/maven.yml</url>
|
||||||
</ciManagement>
|
</ciManagement>
|
||||||
|
|
||||||
<developers>
|
<developers>
|
||||||
@@ -43,8 +43,8 @@
|
|||||||
|
|
||||||
<licenses>
|
<licenses>
|
||||||
<license>
|
<license>
|
||||||
<name>GNU General Public License v3.0</name>
|
<name>The MIT License</name>
|
||||||
<url>https://opensource.org/licenses/GPL-3.0</url>
|
<url>https://opensource.org/licenses/mit-license.php</url>
|
||||||
</license>
|
</license>
|
||||||
</licenses>
|
</licenses>
|
||||||
|
|
||||||
@@ -78,10 +78,18 @@
|
|||||||
<repository>
|
<repository>
|
||||||
<id>github</id>
|
<id>github</id>
|
||||||
<name>GitHub Packages</name>
|
<name>GitHub Packages</name>
|
||||||
<url>https://maven.pkg.github.com/CarmJos/PlayerPrefix</url>
|
<url>https://maven.pkg.github.com/CarmJos/${project.artifactId}</url>
|
||||||
</repository>
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
|
<distributionManagement>
|
||||||
|
<repository>
|
||||||
|
<id>github</id>
|
||||||
|
<name>GitHub Packages</name>
|
||||||
|
<url>https://maven.pkg.github.com/CarmJos/${project.artifactId}</url>
|
||||||
|
</repository>
|
||||||
|
</distributionManagement>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -95,19 +103,20 @@
|
|||||||
<groupId>com.github.azbh111</groupId>
|
<groupId>com.github.azbh111</groupId>
|
||||||
<artifactId>craftbukkit-1.12.2</artifactId>
|
<artifactId>craftbukkit-1.12.2</artifactId>
|
||||||
<version>R</version>
|
<version>R</version>
|
||||||
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<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>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit</artifactId>
|
||||||
<version>4.13</version>
|
<version>4.13.2</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
@@ -119,7 +128,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>1.8</source>
|
<source>1.8</source>
|
||||||
<target>1.8</target>
|
<target>1.8</target>
|
||||||
@@ -130,12 +139,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>
|
||||||
@@ -148,7 +157,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>
|
||||||
@@ -175,7 +184,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>
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||||
|
"extends": [
|
||||||
|
"config:recommended"
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package cc.carm.plugin.playerprefix;
|
package cc.carm.plugin.playerprefix;
|
||||||
|
|
||||||
import cc.carm.plugin.playerprefix.commands.PlayerPrefixCommand;
|
import cc.carm.plugin.playerprefix.commands.PlayerPrefixCommand;
|
||||||
|
import cc.carm.plugin.playerprefix.hooker.PlayerPrefixExpansion;
|
||||||
import cc.carm.plugin.playerprefix.listeners.PrefixListener;
|
import cc.carm.plugin.playerprefix.listeners.PrefixListener;
|
||||||
import cc.carm.plugin.playerprefix.managers.UserPrefixManager;
|
import cc.carm.plugin.playerprefix.managers.UserPrefixManager;
|
||||||
import cc.carm.plugin.playerprefix.utils.MessageParser;
|
import cc.carm.plugin.playerprefix.utils.MessageParser;
|
||||||
@@ -33,6 +34,14 @@ public class Main extends JavaPlugin {
|
|||||||
log("注册监听器...");
|
log("注册监听器...");
|
||||||
Bukkit.getPluginManager().registerEvents(new PrefixListener(), this);
|
Bukkit.getPluginManager().registerEvents(new PrefixListener(), this);
|
||||||
|
|
||||||
|
if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
|
||||||
|
log("注册变量...");
|
||||||
|
new PlayerPrefixExpansion(getInstance()).register();
|
||||||
|
} else {
|
||||||
|
log("未安装 PlaceholderAPI 不进行变量注册...");
|
||||||
|
log("若您想使用变量进行前缀的显示,请安装PlaceholderAPI!");
|
||||||
|
}
|
||||||
|
|
||||||
log("加载完成 ,共耗时 " + (System.currentTimeMillis() - startTime) + " ms 。");
|
log("加载完成 ,共耗时 " + (System.currentTimeMillis() - startTime) + " ms 。");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,57 @@
|
|||||||
|
package cc.carm.plugin.playerprefix.hooker;
|
||||||
|
|
||||||
|
import cc.carm.plugin.playerprefix.managers.UserPrefixManager;
|
||||||
|
import cc.carm.plugin.playerprefix.models.UserPrefixCache;
|
||||||
|
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class PlayerPrefixExpansion extends PlaceholderExpansion {
|
||||||
|
|
||||||
|
JavaPlugin plugin;
|
||||||
|
|
||||||
|
public PlayerPrefixExpansion(JavaPlugin plugin) {
|
||||||
|
this.plugin = plugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull List<String> getPlaceholders() {
|
||||||
|
List<String> placeholders = new ArrayList<>();
|
||||||
|
placeholders.add("%PlayerPrefix%");
|
||||||
|
return placeholders;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canRegister() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull String getAuthor() {
|
||||||
|
return plugin.getDescription().getAuthors().toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull String getIdentifier() {
|
||||||
|
return plugin.getDescription().getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull String getVersion() {
|
||||||
|
return plugin.getDescription().getVersion();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String onPlaceholderRequest(Player player, @NotNull String identifier) {
|
||||||
|
if (player == null) return "加载中...";
|
||||||
|
|
||||||
|
UserPrefixCache cache = UserPrefixManager.getData(player.getUniqueId());
|
||||||
|
|
||||||
|
return cache.getUsingPrefix();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,10 +1,19 @@
|
|||||||
name: PlayerPrefix
|
|
||||||
main: cc.carm.plugin.playerprefix.Main
|
main: cc.carm.plugin.playerprefix.Main
|
||||||
version: ${project}
|
|
||||||
|
name: ${project.name}
|
||||||
|
version: ${project.version}
|
||||||
|
description: ${project.description}
|
||||||
author: CarmJos
|
author: CarmJos
|
||||||
depend: [ ProtocolLib ]
|
website: ${project.url}
|
||||||
website: "https://github.com/CarmJos/PlayerPrefix"
|
|
||||||
|
depend:
|
||||||
|
- ProtocolLib
|
||||||
|
softdepend:
|
||||||
|
- PlaceholderAPI
|
||||||
|
|
||||||
commands:
|
commands:
|
||||||
PlayerPrefix:
|
PlayerPrefix:
|
||||||
aliases:
|
aliases:
|
||||||
- prefix
|
- prefix
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user