mirror of
https://github.com/CarmJos/UserPrefix.git
synced 2026-06-05 09:01:39 +08:00
Compare commits
19 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 99f2b6ff28 | |||
| 5c5a57af5b | |||
| 044cd1a84f | |||
| 29796ec455 | |||
| 898ba5bf27 | |||
| 2e46888019 | |||
| ac55fc135c | |||
| 774e9b764e | |||
| a31da83531 | |||
| 61857d6305 | |||
| dd96188b22 | |||
| eb4ecaada9 | |||
| acc9ea7e7c | |||
| 83b3c45d57 | |||
| 3ec39b9ca3 | |||
| 821b42cc03 | |||
| 81e0c0960f | |||
| 99c577c361 | |||
| 5df6e1fe34 |
@@ -1,30 +1,29 @@
|
||||
---
|
||||
name: 问题提交
|
||||
about: 描述问题并提交,帮助我们对其进行检查与修复。
|
||||
title: ''
|
||||
labels: bug
|
||||
assignees: ''
|
||||
name: 问题提交 about: 描述问题并提交,帮助我们对其进行检查与修复。 title: ''
|
||||
labels: bug assignees: ''
|
||||
|
||||
---
|
||||
|
||||
### **问题简述**
|
||||
用简短的话语描述一下大概问题。
|
||||
<!--用简短的话语描述一下大概问题。-->
|
||||
|
||||
### **问题来源**
|
||||
|
||||
<!--
|
||||
描述一下通过哪些操作才发现的问题,如:
|
||||
1. 打开 '...'
|
||||
2. 点击了 '....'
|
||||
3. 出现了报错 '....'
|
||||
-->
|
||||
|
||||
### **预期结果**(可选)
|
||||
如果问题不发生,应该是什么情况
|
||||
<!--如果问题不发生,应该是什么情况-->
|
||||
|
||||
### **问题截图/问题报错**
|
||||
如果有报错或输出,请提供截图。
|
||||
<!--如果有报错或输出,请提供截图。-->
|
||||
|
||||
### **操作环境**
|
||||
请在后台输入 `version` 并复制相关输出。
|
||||
|
||||
<!--请在后台输入 `version` 并复制相关输出。-->
|
||||
|
||||
### **其他补充**
|
||||
如有其他补充,可以在这里描述。
|
||||
<!--如有其他补充,可以在这里描述。-->
|
||||
|
||||
@@ -8,13 +8,13 @@ assignees: ''
|
||||
---
|
||||
|
||||
### **功能简述**
|
||||
简单的描述一下你想要的功能
|
||||
<!--简单的描述一下你想要的功能-->
|
||||
|
||||
### **需求来源**
|
||||
简单的描述一下为什么需要这个功能。
|
||||
<!--简单的描述一下为什么需要这个功能。-->
|
||||
|
||||
### **功能参考**(可选)
|
||||
如果有相关功能的参考,如文本、截图,请提供给我们。
|
||||
<!--如果有相关功能的参考,如文本、截图,请提供给我们。-->
|
||||
|
||||
### **附加内容**
|
||||
如果有什么小细节需要重点注意,请在这里告诉我们。
|
||||
<!--如果有什么小细节需要重点注意,请在这里告诉我们。-->
|
||||
|
||||
@@ -31,9 +31,13 @@ jobs:
|
||||
MAVEN_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
||||
|
||||
- name: "Target Staging"
|
||||
run: mkdir staging && cp target/*.jar staging
|
||||
run: |
|
||||
mkdir artifacts
|
||||
cp -vrf target/ artifacts/target/
|
||||
cp -vrf asset/*.jar artifacts
|
||||
|
||||
- name: "Upload artifact"
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: Artifact
|
||||
path: staging
|
||||
path: artifacts
|
||||
@@ -1,5 +1,7 @@
|
||||

|
||||
|
||||
README LANGUAGES [ [中文](README.md) | [**English**](README-en.md) ]
|
||||
|
||||
# UserPrefix Plugin
|
||||
|
||||
[](https://www.codefactor.io/repository/github/carmjos/userprefix)
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||

|
||||
|
||||
README LANGUAGES [ [**中文**](README.md) | [English](README-en.md) ]
|
||||
|
||||
# 用户前缀系统插件
|
||||
|
||||
[](https://www.codefactor.io/repository/github/carmjos/userprefix)
|
||||
@@ -13,8 +15,6 @@
|
||||
|
||||
本插件基于Spigot实现,**理论上支持全版本**。
|
||||
|
||||
The **English version** of the introduction is [here](README-en.md).
|
||||
|
||||
> 本插件已在 [MCBBS](https://www.mcbbs.net/forum.php?mod=viewthread&tid=1261503) 与 [SpigotMC](https://www.spigotmc.org/resources/userprefix-hex-color-support-all-version.96277/) 上发布。
|
||||
|
||||
## 示例
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
<groupId>cc.carm.plugin</groupId>
|
||||
<artifactId>userprefix</artifactId>
|
||||
<version>2.3.3</version>
|
||||
<version>2.4.3</version>
|
||||
|
||||
<name>UserPrefix</name>
|
||||
<description>轻便、高效、实时的用户前缀系统。</description>
|
||||
@@ -80,6 +80,11 @@
|
||||
<url>https://repo1.maven.org/maven2/</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>sonatype-repo</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>github</id>
|
||||
<name>GitHub Packages</name>
|
||||
@@ -123,7 +128,14 @@
|
||||
<dependency>
|
||||
<groupId>org.bstats</groupId>
|
||||
<artifactId>bstats-bukkit</artifactId>
|
||||
<version>2.2.1</version>
|
||||
<version>3.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cc.carm.lib</groupId>
|
||||
<artifactId>githubreleases4j</artifactId>
|
||||
<version>1.3.1</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -200,20 +212,25 @@
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<finalName>${project.name}-${project.version}</finalName>
|
||||
<outputDirectory>${project.basedir}/asset/</outputDirectory>
|
||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<finalName>${project.name}-${project.version}</finalName>
|
||||
<outputDirectory>${project.basedir}/asset/</outputDirectory>
|
||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||
<relocations>
|
||||
<relocation>
|
||||
<pattern>org.bstats</pattern>
|
||||
<!-- Replace this with your package! -->
|
||||
<shadedPattern>cc.carm.plugin.userprefix.bstats</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>cc.carm.lib.githubreleases4j</pattern>
|
||||
<shadedPattern>cc.carm.plugin.userprefix.lib.github</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>org.json</pattern>
|
||||
<shadedPattern>cc.carm.plugin.userprefix.lib.json</shadedPattern>
|
||||
</relocation>
|
||||
</relocations>
|
||||
<filters>
|
||||
<filter>
|
||||
@@ -244,4 +261,4 @@
|
||||
</build>
|
||||
|
||||
|
||||
</project>
|
||||
</project>
|
||||
|
||||
@@ -3,6 +3,7 @@ package cc.carm.plugin.userprefix;
|
||||
import cc.carm.plugin.userprefix.command.UserPrefixAdminCommand;
|
||||
import cc.carm.plugin.userprefix.command.UserPrefixCommand;
|
||||
import cc.carm.plugin.userprefix.configuration.PluginConfig;
|
||||
import cc.carm.plugin.userprefix.hooker.UpdateChecker;
|
||||
import cc.carm.plugin.userprefix.hooker.UserPrefixExpansion;
|
||||
import cc.carm.plugin.userprefix.listener.ChatListener;
|
||||
import cc.carm.plugin.userprefix.listener.UserListener;
|
||||
@@ -13,6 +14,7 @@ import cc.carm.plugin.userprefix.manager.ServiceManager;
|
||||
import cc.carm.plugin.userprefix.manager.UserManager;
|
||||
import cc.carm.plugin.userprefix.util.ColorParser;
|
||||
import cc.carm.plugin.userprefix.util.MessageUtil;
|
||||
import cc.carm.plugin.userprefix.wrapper.ItemStackWrapper;
|
||||
import net.luckperms.api.event.user.UserDataRecalculateEvent;
|
||||
import org.bstats.bukkit.Metrics;
|
||||
import org.bstats.charts.SimplePie;
|
||||
@@ -21,6 +23,7 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.PluginCommand;
|
||||
import org.bukkit.command.TabCompleter;
|
||||
import org.bukkit.configuration.serialization.ConfigurationSerialization;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
@@ -29,132 +32,142 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class Main extends JavaPlugin {
|
||||
|
||||
private static Main instance;
|
||||
private static Main instance;
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
instance = this;
|
||||
showPluginName();
|
||||
log(getName() + " " + getDescription().getVersion() + " &7开始加载...");
|
||||
long startTime = System.currentTimeMillis();
|
||||
@Override
|
||||
public void onEnable() {
|
||||
instance = this;
|
||||
showPluginName();
|
||||
log(getName() + " " + getDescription().getVersion() + " &7开始加载...");
|
||||
long startTime = System.currentTimeMillis();
|
||||
|
||||
log("加载配置文件...");
|
||||
ConfigManager.initConfig();
|
||||
PrefixManager.init();
|
||||
log("注入序列化处理工具...");
|
||||
ConfigurationSerialization.registerClass(ItemStackWrapper.class);
|
||||
|
||||
log("注册指令...");
|
||||
registerCommand("UserPrefix", new UserPrefixCommand());
|
||||
registerCommand("UserPrefixAdmin", new UserPrefixAdminCommand());
|
||||
log("加载配置文件...");
|
||||
ConfigManager.initConfig();
|
||||
PrefixManager.init();
|
||||
|
||||
log("注册监听器...");
|
||||
regListener(new UserListener());
|
||||
regListener(new ChatListener());
|
||||
ServiceManager.getService().getEventBus().subscribe(this, UserDataRecalculateEvent.class, UserNodeUpdateProcessor::process);
|
||||
log("注册指令...");
|
||||
registerCommand("UserPrefix", new UserPrefixCommand());
|
||||
registerCommand("UserPrefixAdmin", new UserPrefixAdminCommand());
|
||||
|
||||
if (MessageUtil.hasPlaceholderAPI()) {
|
||||
log("注册变量...");
|
||||
new UserPrefixExpansion(getInstance()).register();
|
||||
} else {
|
||||
log("未安装 PlaceholderAPI 不进行变量注册...");
|
||||
log("若您想使用变量进行前缀的显示,请安装PlaceholderAPI!");
|
||||
}
|
||||
log("注册监听器...");
|
||||
regListener(new UserListener());
|
||||
regListener(new ChatListener());
|
||||
ServiceManager.getService().getEventBus().subscribe(this, UserDataRecalculateEvent.class, UserNodeUpdateProcessor::process);
|
||||
|
||||
if (PluginConfig.METRICS.get()) {
|
||||
log("启用统计数据...");
|
||||
Metrics metrics = new Metrics(this, 13776);
|
||||
metrics.addCustomChart(new SingleLineChart("active_prefixes", () -> PrefixManager.getPrefixes().size()));
|
||||
metrics.addCustomChart(new SimplePie("custom_storage", () -> PluginConfig.CustomStorage.ENABLE.get() ? "ENABLE" : "DISABLE"));
|
||||
metrics.addCustomChart(new SimplePie("lp_version", () -> ServiceManager.getService().getPluginMetadata().getVersion()));
|
||||
metrics.addCustomChart(new SimplePie("papi_version", () -> {
|
||||
Plugin plugin = Bukkit.getPluginManager().getPlugin("PlaceholderAPI");
|
||||
if (plugin == null) return "Not installed";
|
||||
else return plugin.getDescription().getVersion();
|
||||
}));
|
||||
}
|
||||
if (MessageUtil.hasPlaceholderAPI()) {
|
||||
log("注册变量...");
|
||||
new UserPrefixExpansion(getInstance()).register();
|
||||
} else {
|
||||
log("未安装 PlaceholderAPI 不进行变量注册...");
|
||||
log("若您想使用变量进行前缀的显示,请安装PlaceholderAPI!");
|
||||
}
|
||||
|
||||
log("加载完成 ,共耗时 " + (System.currentTimeMillis() - startTime) + " ms 。");
|
||||
if (PluginConfig.METRICS.get()) {
|
||||
log("启用统计数据...");
|
||||
Metrics metrics = new Metrics(this, 13776);
|
||||
metrics.addCustomChart(new SingleLineChart("active_prefixes", () -> PrefixManager.getPrefixes().size()));
|
||||
metrics.addCustomChart(new SimplePie("custom_storage", () -> PluginConfig.CustomStorage.ENABLE.get() ? "ENABLE" : "DISABLE"));
|
||||
metrics.addCustomChart(new SimplePie("lp_version", () -> ServiceManager.getService().getPluginMetadata().getVersion()));
|
||||
metrics.addCustomChart(new SimplePie("papi_version", () -> {
|
||||
Plugin plugin = Bukkit.getPluginManager().getPlugin("PlaceholderAPI");
|
||||
if (plugin == null) return "Not installed";
|
||||
else return plugin.getDescription().getVersion();
|
||||
}));
|
||||
}
|
||||
|
||||
showAD();
|
||||
if (PluginConfig.CHECK_UPDATE.get()) {
|
||||
log("开始检查更新...");
|
||||
UpdateChecker.checkUpdate(getDescription().getVersion());
|
||||
} else {
|
||||
log("已禁用检查更新,跳过。");
|
||||
}
|
||||
|
||||
if (Bukkit.getOnlinePlayers().size() > 0) {
|
||||
Bukkit.getOnlinePlayers().forEach(UserManager::initPlayer); // 适配热重载
|
||||
}
|
||||
log("加载完成 ,共耗时 " + (System.currentTimeMillis() - startTime) + " ms 。");
|
||||
|
||||
showAD();
|
||||
|
||||
if (Bukkit.getOnlinePlayers().size() > 0) {
|
||||
Bukkit.getOnlinePlayers().forEach(UserManager::initPlayer); // 适配热重载
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
showPluginName();
|
||||
log(getName() + " " + getDescription().getVersion() + " 开始卸载...");
|
||||
long startTime = System.currentTimeMillis();
|
||||
@Override
|
||||
public void onDisable() {
|
||||
showPluginName();
|
||||
log(getName() + " " + getDescription().getVersion() + " 开始卸载...");
|
||||
long startTime = System.currentTimeMillis();
|
||||
|
||||
log("卸载监听器...");
|
||||
Bukkit.getServicesManager().unregisterAll(this);
|
||||
log("卸载监听器...");
|
||||
Bukkit.getServicesManager().unregisterAll(this);
|
||||
|
||||
log("卸载完成 ,共耗时 " + (System.currentTimeMillis() - startTime) + " ms 。");
|
||||
log("卸载完成 ,共耗时 " + (System.currentTimeMillis() - startTime) + " ms 。");
|
||||
|
||||
showAD();
|
||||
showAD();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册监听器
|
||||
*
|
||||
* @param listener 监听器
|
||||
*/
|
||||
public static void regListener(Listener listener) {
|
||||
Bukkit.getPluginManager().registerEvents(listener, getInstance());
|
||||
}
|
||||
/**
|
||||
* 注册监听器
|
||||
*
|
||||
* @param listener 监听器
|
||||
*/
|
||||
public static void regListener(Listener listener) {
|
||||
Bukkit.getPluginManager().registerEvents(listener, getInstance());
|
||||
}
|
||||
|
||||
public static void log(String message) {
|
||||
Bukkit.getConsoleSender().sendMessage(ColorParser.parse("[" + getInstance().getName() + "] " + message));
|
||||
}
|
||||
public static void log(String message) {
|
||||
Bukkit.getConsoleSender().sendMessage(ColorParser.parse("[" + getInstance().getName() + "] " + message));
|
||||
}
|
||||
|
||||
public static void debug(String message) {
|
||||
if (PluginConfig.DEBUG.get()) {
|
||||
log("[DEBUG] " + message);
|
||||
}
|
||||
}
|
||||
public static void debug(String message) {
|
||||
if (PluginConfig.DEBUG.get()) {
|
||||
log("[DEBUG] " + message);
|
||||
}
|
||||
}
|
||||
|
||||
public static void error(String message) {
|
||||
log("&c[ERROR] &r" + message);
|
||||
}
|
||||
public static void error(String message) {
|
||||
log("&c[ERROR] &r" + message);
|
||||
}
|
||||
|
||||
|
||||
public static JavaPlugin getInstance() {
|
||||
return instance;
|
||||
}
|
||||
public static JavaPlugin getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
|
||||
public static void registerCommand(String commandName,
|
||||
@NotNull CommandExecutor executor) {
|
||||
registerCommand(commandName, executor, null);
|
||||
}
|
||||
public static void registerCommand(String commandName,
|
||||
@NotNull CommandExecutor executor) {
|
||||
registerCommand(commandName, executor, null);
|
||||
}
|
||||
|
||||
public static void registerCommand(String commandName,
|
||||
@NotNull CommandExecutor executor,
|
||||
@Nullable TabCompleter tabCompleter) {
|
||||
PluginCommand command = Bukkit.getPluginCommand(commandName);
|
||||
if (command == null) return;
|
||||
command.setExecutor(executor);
|
||||
if (tabCompleter != null) command.setTabCompleter(tabCompleter);
|
||||
}
|
||||
public static void registerCommand(String commandName,
|
||||
@NotNull CommandExecutor executor,
|
||||
@Nullable TabCompleter tabCompleter) {
|
||||
PluginCommand command = Bukkit.getPluginCommand(commandName);
|
||||
if (command == null) return;
|
||||
command.setExecutor(executor);
|
||||
if (tabCompleter != null) command.setTabCompleter(tabCompleter);
|
||||
}
|
||||
|
||||
private void showPluginName() {
|
||||
log("&b _ _ &f _____ __ _ ");
|
||||
log("&b| | | | &f| __ \\ / _|(_) ");
|
||||
log("&b| | | | ___ ___ _ __ &f| |__) |_ __ ___ | |_ _ __ __");
|
||||
log("&b| | | |/ __| / _ \\| '__|&f| ___/| '__|/ _ \\| _|| |\\ \\/ /");
|
||||
log("&b| |__| |\\__ \\| __/| | &f| | | | | __/| | | | > < ");
|
||||
log("&b \\____/ |___/ \\___||_| &f|_| |_| \\___||_| |_|/_/\\_\\");
|
||||
log("&8 ");
|
||||
log("&8> &f" + getDescription().getWebsite());
|
||||
}
|
||||
private void showPluginName() {
|
||||
log("&b _ _ &f _____ __ _ ");
|
||||
log("&b| | | | &f| __ \\ / _|(_) ");
|
||||
log("&b| | | | ___ ___ _ __ &f| |__) |_ __ ___ | |_ _ __ __");
|
||||
log("&b| | | |/ __| / _ \\| '__|&f| ___/| '__|/ _ \\| _|| |\\ \\/ /");
|
||||
log("&b| |__| |\\__ \\| __/| | &f| | | | | __/| | | | > < ");
|
||||
log("&b \\____/ |___/ \\___||_| &f|_| |_| \\___||_| |_|/_/\\_\\");
|
||||
log("&8 ");
|
||||
log("&8> &f" + getDescription().getWebsite());
|
||||
}
|
||||
|
||||
private void showAD() {
|
||||
log("&7感谢您使用 &3&lUserPrefix " + getDescription().getVersion() + "&7!");
|
||||
log("&7本插件由 &b&lYourCraft &7提供长期支持与维护。");
|
||||
}
|
||||
private void showAD() {
|
||||
log("&7感谢您使用 &3&lUserPrefix " + getDescription().getVersion() + "&7!");
|
||||
log("&7本插件由 &b&lYourCraft &7提供长期支持与维护。");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -9,77 +9,81 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class PluginConfig {
|
||||
|
||||
public static ConfigValue<Boolean> DEBUG = new ConfigValue<>("debug", Boolean.class, false);
|
||||
public static ConfigValue<Boolean> DEBUG = new ConfigValue<>("debug", Boolean.class, false);
|
||||
|
||||
public static ConfigValue<Boolean> METRICS = new ConfigValue<>("metrics", Boolean.class, true);
|
||||
public static ConfigValue<Boolean> METRICS = new ConfigValue<>("metrics", Boolean.class, true);
|
||||
|
||||
public static class CustomStorage {
|
||||
public static final ConfigValue<Boolean> CHECK_UPDATE = new ConfigValue<>("check-update", Boolean.class, true);
|
||||
|
||||
public static ConfigValue<Boolean> ENABLE = new ConfigValue<>("custom-storage.enable", Boolean.class, false);
|
||||
public static class CustomStorage {
|
||||
|
||||
public static ConfigValue<String> PATH = new ConfigValue<>("custom-storage.path", String.class, "prefixes/");
|
||||
public static ConfigValue<Boolean> ENABLE = new ConfigValue<>("custom-storage.enable", Boolean.class, false);
|
||||
|
||||
}
|
||||
public static ConfigValue<String> PATH = new ConfigValue<>("custom-storage.path", String.class, "prefixes/");
|
||||
|
||||
public static class Functions {
|
||||
}
|
||||
|
||||
public static ConfigValue<Boolean> NAME_PREFIX = new ConfigValue<>("functions.OnNamePrefix", Boolean.class, true);
|
||||
public static ConfigValue<Boolean> AUTO_USE = new ConfigValue<>("functions.autoUsePrefix", Boolean.class, true);
|
||||
public static class Functions {
|
||||
|
||||
public static class Chat {
|
||||
public static ConfigValue<Boolean> NAME_PREFIX = new ConfigValue<>("functions.on-name-prefix.enable", Boolean.class, true);
|
||||
public static ConfigValue<Boolean> NAME_ORDER_DESC = new ConfigValue<>("functions.on-name-prefix.order-desc", Boolean.class, true);
|
||||
|
||||
public static ConfigValue<Boolean> ENABLE = new ConfigValue<>("functions.chat.enable", Boolean.class, false);
|
||||
public static ConfigValue<String> FORMAT = new ConfigValue<>("functions.chat.format", String.class, "<%1$s> %2$s");
|
||||
public static ConfigValue<Boolean> AUTO_USE = new ConfigValue<>("functions.auto-prefix-use", Boolean.class, true);
|
||||
|
||||
}
|
||||
public static class Chat {
|
||||
|
||||
}
|
||||
public static ConfigValue<Boolean> ENABLE = new ConfigValue<>("functions.chat.enable", Boolean.class, false);
|
||||
public static ConfigValue<String> FORMAT = new ConfigValue<>("functions.chat.format", String.class, "<%1$s> %2$s");
|
||||
|
||||
public static class GUI {
|
||||
}
|
||||
|
||||
public static ConfigValue<String> TITLE = new ConfigValue<>("GUI.title", String.class, "&f&l我的前缀 &8| 列表");
|
||||
}
|
||||
|
||||
public static class Items {
|
||||
public static class GUI {
|
||||
|
||||
public static ConfigValue<ItemStack> NEXT_PAGE = new ConfigValue<>("GUI.items.next-page", ItemStack.class,
|
||||
new ItemStackFactory(Material.ARROW)
|
||||
.setDisplayName("下一页")
|
||||
.addLore("&7&o右键可前往最后一页哦")
|
||||
.toItemStack()
|
||||
);
|
||||
public static ConfigValue<ItemStack> PREVIOUS_PAGE = new ConfigValue<>("GUI.items.previous-page", ItemStack.class,
|
||||
new ItemStackFactory(Material.ARROW)
|
||||
.setDisplayName("上一页")
|
||||
.addLore("&7&o右键可前往第一页哦")
|
||||
.toItemStack()
|
||||
);
|
||||
public static ConfigValue<String> TITLE = new ConfigValue<>("GUI.title", String.class, "&f&l我的前缀 &8| 列表");
|
||||
|
||||
}
|
||||
public static class Items {
|
||||
|
||||
}
|
||||
public static ConfigValue<ItemStack> NEXT_PAGE = new ConfigValue<>("GUI.items.next-page", ItemStack.class,
|
||||
new ItemStackFactory(Material.ARROW)
|
||||
.setDisplayName("下一页")
|
||||
.addLore("&7&o右键可前往最后一页哦")
|
||||
.toItemStack()
|
||||
);
|
||||
public static ConfigValue<ItemStack> PREVIOUS_PAGE = new ConfigValue<>("GUI.items.previous-page", ItemStack.class,
|
||||
new ItemStackFactory(Material.ARROW)
|
||||
.setDisplayName("上一页")
|
||||
.addLore("&7&o右键可前往第一页哦")
|
||||
.toItemStack()
|
||||
);
|
||||
|
||||
public static class Messages {
|
||||
}
|
||||
|
||||
public static ConfigMessageList SELECTED = new ConfigMessageList("selected");
|
||||
public static ConfigMessageList EXPIRED = new ConfigMessageList("expired");
|
||||
public static ConfigMessageList REMOVED = new ConfigMessageList("removed");
|
||||
}
|
||||
|
||||
public static ConfigMessageList RELOAD = new ConfigMessageList("reload");
|
||||
public static ConfigMessageList HELP = new ConfigMessageList("help");
|
||||
public static class Messages {
|
||||
|
||||
public static ConfigMessageList LIST_TITLE = new ConfigMessageList("list-title");
|
||||
public static ConfigMessageList LIST_VALUE = new ConfigMessageList("list-value");
|
||||
public static ConfigMessageList SELECTED = new ConfigMessageList("selected");
|
||||
public static ConfigMessageList EXPIRED = new ConfigMessageList("expired");
|
||||
public static ConfigMessageList REMOVED = new ConfigMessageList("removed");
|
||||
|
||||
}
|
||||
public static ConfigMessageList RELOAD = new ConfigMessageList("reload");
|
||||
public static ConfigMessageList HELP = new ConfigMessageList("help");
|
||||
|
||||
public static class Sounds {
|
||||
public static ConfigMessageList LIST_TITLE = new ConfigMessageList("list-title");
|
||||
public static ConfigMessageList LIST_VALUE = new ConfigMessageList("list-value");
|
||||
|
||||
public static ConfigSound GUI_OPEN = new ConfigSound("Sounds.openGUI");
|
||||
public static ConfigSound GUI_CLICK = new ConfigSound("Sounds.guiClick");
|
||||
public static ConfigSound PREFIX_CHANGE = new ConfigSound("Sounds.prefixChange");
|
||||
public static ConfigSound PREFIX_EXPIRED = new ConfigSound("Sounds.prefixExpired");
|
||||
}
|
||||
|
||||
}
|
||||
public static class Sounds {
|
||||
|
||||
public static ConfigSound GUI_OPEN = new ConfigSound("Sounds.openGUI");
|
||||
public static ConfigSound GUI_CLICK = new ConfigSound("Sounds.guiClick");
|
||||
public static ConfigSound PREFIX_CHANGE = new ConfigSound("Sounds.prefixChange");
|
||||
public static ConfigSound PREFIX_EXPIRED = new ConfigSound("Sounds.prefixExpired");
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package cc.carm.plugin.userprefix.configuration.file;
|
||||
|
||||
|
||||
import cc.carm.plugin.userprefix.util.ConfigurationUtil;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.io.File;
|
||||
@@ -35,7 +35,7 @@ public class FileConfig {
|
||||
}
|
||||
plugin.saveResource(fileName, true);
|
||||
}
|
||||
this.config = YamlConfiguration.loadConfiguration(this.file);
|
||||
this.config = ConfigurationUtil.bang(this.file);
|
||||
}
|
||||
|
||||
public File getFile() {
|
||||
@@ -56,7 +56,7 @@ public class FileConfig {
|
||||
|
||||
public void reload() {
|
||||
if (getFile().exists()) {
|
||||
this.config = YamlConfiguration.loadConfiguration(getFile());
|
||||
this.config = ConfigurationUtil.bang(getFile());
|
||||
} else {
|
||||
initFile();
|
||||
}
|
||||
|
||||
@@ -1,12 +1,17 @@
|
||||
package cc.carm.plugin.userprefix.event;
|
||||
|
||||
import cc.carm.plugin.userprefix.Main;
|
||||
import cc.carm.plugin.userprefix.model.ConfiguredPrefix;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class UserPrefixChangeEvent extends UserPrefixEvent implements Cancellable {
|
||||
|
||||
public static HandlerList handler = new HandlerList();
|
||||
@@ -52,4 +57,19 @@ public class UserPrefixChangeEvent extends UserPrefixEvent implements Cancellabl
|
||||
public HandlerList getHandlers() {
|
||||
return handler;
|
||||
}
|
||||
|
||||
public static void call(@NotNull Player who,
|
||||
@Nullable ConfiguredPrefix before,
|
||||
@NotNull ConfiguredPrefix after,
|
||||
@Nullable Consumer<@Nullable ConfiguredPrefix> finish) {
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
UserPrefixChangeEvent event = new UserPrefixChangeEvent(who, before, after);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
if (finish != null) finish.accept(event.isCancelled() ? null : event.getAfter());
|
||||
}
|
||||
}.runTask(Main.getInstance());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
package cc.carm.plugin.userprefix.event;
|
||||
|
||||
import cc.carm.plugin.userprefix.Main;
|
||||
import cc.carm.plugin.userprefix.model.ConfiguredPrefix;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class UserPrefixExpireEvent extends UserPrefixEvent {
|
||||
@@ -27,4 +30,14 @@ public class UserPrefixExpireEvent extends UserPrefixEvent {
|
||||
public HandlerList getHandlers() {
|
||||
return handler;
|
||||
}
|
||||
|
||||
public static void call(@NotNull Player player, @NotNull ConfiguredPrefix currentPrefix) {
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Bukkit.getPluginManager().callEvent(new UserPrefixExpireEvent(player, currentPrefix));
|
||||
}
|
||||
}.runTask(Main.getInstance());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package cc.carm.plugin.userprefix.hooker;
|
||||
|
||||
import cc.carm.lib.githubreleases4j.GithubReleases4J;
|
||||
import cc.carm.plugin.userprefix.Main;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public class UpdateChecker {
|
||||
|
||||
public static void checkUpdate(String currentVersion) {
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String downloadURL = GithubReleases4J.getReleasesURL("CarmJos", "UserPrefix");
|
||||
Integer behindVersions = GithubReleases4J.getVersionBehind(
|
||||
"CarmJos", "UserPrefix", currentVersion
|
||||
);
|
||||
|
||||
if (behindVersions == null) {
|
||||
Main.error("检查更新失败,请您定期查看插件是否更新,避免安全问题。");
|
||||
Main.error("下载地址 " + downloadURL);
|
||||
} else if (behindVersions == 0) {
|
||||
Main.log("检查完成,当前已是最新版本。");
|
||||
} else if (behindVersions > 0) {
|
||||
Main.log("发现新版本! 目前已落后 " + behindVersions + " 个版本。");
|
||||
Main.log("最新版下载地址 " + downloadURL);
|
||||
} else {
|
||||
Main.error("检查更新失败! 当前版本未知,请您使用原生版本以避免安全问题。");
|
||||
Main.error("最新版下载地址 " + downloadURL);
|
||||
}
|
||||
}
|
||||
}.runTaskAsynchronously(Main.getInstance());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -21,270 +21,272 @@ import java.util.stream.Collectors;
|
||||
|
||||
public class UserManager {
|
||||
|
||||
public static HashMap<UUID, UserNameTag> nameTags = new HashMap<>();
|
||||
public static HashMap<UUID, UserNameTag> nameTags = new HashMap<>();
|
||||
|
||||
public static HashSet<UUID> checkingPlayers = new HashSet<>();
|
||||
public static HashSet<UUID> checkingPlayers = new HashSet<>();
|
||||
|
||||
@Nullable
|
||||
public static UserNameTag getNameTag(Player player) {
|
||||
if (PluginConfig.Functions.NAME_PREFIX.get()) {
|
||||
if (nameTags.containsKey(player.getUniqueId())) {
|
||||
return nameTags.get(player.getUniqueId());
|
||||
} else {
|
||||
return createNameTag(player);
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@Nullable
|
||||
public static UserNameTag getNameTag(Player player) {
|
||||
if (PluginConfig.Functions.NAME_PREFIX.get()) {
|
||||
if (nameTags.containsKey(player.getUniqueId())) {
|
||||
return nameTags.get(player.getUniqueId());
|
||||
} else {
|
||||
return createNameTag(player);
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static UserNameTag createNameTag(Player player) {
|
||||
if (nameTags.containsKey(player.getUniqueId())) return nameTags.get(player.getUniqueId());
|
||||
UserNameTag nameTag = new UserNameTag(player);
|
||||
nameTags.put(player.getUniqueId(), nameTag);
|
||||
return nameTag;
|
||||
}
|
||||
@NotNull
|
||||
public static UserNameTag createNameTag(Player player) {
|
||||
if (nameTags.containsKey(player.getUniqueId())) return nameTags.get(player.getUniqueId());
|
||||
UserNameTag nameTag = new UserNameTag(player);
|
||||
nameTags.put(player.getUniqueId(), nameTag);
|
||||
return nameTag;
|
||||
}
|
||||
|
||||
public static void initPlayer(Player player) {
|
||||
UserManager.checkPrefix(player, false);
|
||||
if (PluginConfig.Functions.NAME_PREFIX.get()) {
|
||||
UserManager.createNameTag(player);
|
||||
UserManager.updatePrefixView(player, true);
|
||||
}
|
||||
}
|
||||
public static void initPlayer(Player player) {
|
||||
UserManager.checkPrefix(player, false);
|
||||
if (PluginConfig.Functions.NAME_PREFIX.get()) {
|
||||
UserManager.createNameTag(player);
|
||||
UserManager.updatePrefixView(player, true);
|
||||
}
|
||||
}
|
||||
|
||||
public static void unloadPlayer(Player player) {
|
||||
PrefixSelectGUI.removeOpening(player);
|
||||
UserManager.unloadNameTag(player.getUniqueId());
|
||||
UserManager.checkingPlayers.remove(player.getUniqueId());
|
||||
GUI.removeOpenedGUI(player); // 清空打开过的GUI缓存 (用于记录物品点击的
|
||||
}
|
||||
public static void unloadPlayer(Player player) {
|
||||
PrefixSelectGUI.removeOpening(player);
|
||||
UserManager.unloadNameTag(player.getUniqueId());
|
||||
UserManager.checkingPlayers.remove(player.getUniqueId());
|
||||
GUI.removeOpenedGUI(player); // 清空打开过的GUI缓存 (用于记录物品点击的
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新前缀显示效果
|
||||
*
|
||||
* @param player 玩家
|
||||
* @param loadOthers 是否为玩家更新其他人的前缀(一般用于加入游戏)
|
||||
*/
|
||||
public static void updatePrefixView(Player player, boolean loadOthers) {
|
||||
if (!PluginConfig.Functions.NAME_PREFIX.get()) return; //未启用的情况下,不需要进行任何操作。
|
||||
UserNameTag tag = getNameTag(player);
|
||||
if (tag == null) return; //未启用的情况下,不需要进行任何操作。
|
||||
/**
|
||||
* 更新前缀显示效果
|
||||
*
|
||||
* @param player 玩家
|
||||
* @param loadOthers 是否为玩家更新其他人的前缀(一般用于加入游戏)
|
||||
*/
|
||||
public static void updatePrefixView(Player player, boolean loadOthers) {
|
||||
if (!PluginConfig.Functions.NAME_PREFIX.get()) return; //未启用的情况下,不需要进行任何操作。
|
||||
UserNameTag tag = getNameTag(player);
|
||||
if (tag == null) return; //未启用的情况下,不需要进行任何操作。
|
||||
|
||||
ConfiguredPrefix playerPrefix = UserManager.getPrefix(player);
|
||||
ConfiguredPrefix playerPrefix = UserManager.getPrefix(player);
|
||||
boolean descOrder = PluginConfig.Functions.NAME_ORDER_DESC.get();
|
||||
|
||||
tag.setPrefix(playerPrefix.getContent());
|
||||
tag.setOrder(playerPrefix.getWeight());
|
||||
tag.setPrefix(playerPrefix.getContent());
|
||||
tag.setOrder(descOrder ? 999 - playerPrefix.getWeight() : playerPrefix.getWeight());
|
||||
|
||||
Main.debug("为玩家 " + player.getName() + " 设置了 " + player.getName() + "的前缀为 #" + playerPrefix.getWeight() + " " + playerPrefix.getName());
|
||||
Main.debug("为玩家 " + player.getName() + " 设置了 " + player.getName() + "的前缀为 #" + playerPrefix.getWeight() + " " + playerPrefix.getName());
|
||||
|
||||
for (Player onlinePlayer : Bukkit.getOnlinePlayers()) {
|
||||
if (onlinePlayer.equals(player)) continue;
|
||||
UserNameTag onlinePlayerTag = getNameTag(onlinePlayer);
|
||||
if (onlinePlayerTag != null) {
|
||||
onlinePlayerTag.setPrefix(player, playerPrefix.getContent());
|
||||
onlinePlayerTag.setOrder(player, playerPrefix.getWeight());
|
||||
Main.debug("为玩家 " + onlinePlayer.getName() + " 设置了 " + player.getName() + "的前缀为 #" + playerPrefix.getWeight() + " " + playerPrefix.getName());
|
||||
for (Player onlinePlayer : Bukkit.getOnlinePlayers()) {
|
||||
if (onlinePlayer.equals(player)) continue;
|
||||
UserNameTag onlinePlayerTag = getNameTag(onlinePlayer);
|
||||
|
||||
}
|
||||
if (onlinePlayerTag != null) {
|
||||
onlinePlayerTag.setPrefix(player, playerPrefix.getContent());
|
||||
onlinePlayerTag.setOrder(player, descOrder ? 999 - playerPrefix.getWeight() : playerPrefix.getWeight());
|
||||
Main.debug("为玩家 " + onlinePlayer.getName() + " 设置了 " + player.getName() + "的前缀为 #" + playerPrefix.getWeight() + " " + playerPrefix.getName());
|
||||
|
||||
if (loadOthers) {
|
||||
ConfiguredPrefix onlinePlayerPrefix = UserManager.getPrefix(onlinePlayer);
|
||||
tag.setPrefix(onlinePlayer, onlinePlayerPrefix.getContent());
|
||||
tag.setOrder(onlinePlayer, onlinePlayerPrefix.getWeight());
|
||||
Main.debug("为玩家 " + player.getName() + " 设置了 " + onlinePlayer.getName() + "的前缀为 #" + onlinePlayerPrefix.getWeight() + " " + onlinePlayerPrefix.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查玩家的前缀的使用权
|
||||
*
|
||||
* @param player 玩家
|
||||
* @param updateView 是否更新头顶与TabList中的前缀
|
||||
*/
|
||||
public static void checkPrefix(Player player, boolean updateView) {
|
||||
if (checkingPlayers.contains(player.getUniqueId())) {
|
||||
/*
|
||||
* 这里为了避免极短时间内的重复触发导致多次判断且结果相同误导玩家,
|
||||
* 故没有采用同步锁,而是采用添加到一个临时Set中,对Set中玩家跳过判断。
|
||||
*/
|
||||
return;
|
||||
}
|
||||
checkingPlayers.add(player.getUniqueId());
|
||||
String currentPrefixData = UserManager.getPrefixData(player);
|
||||
if (loadOthers) {
|
||||
ConfiguredPrefix onlinePlayerPrefix = UserManager.getPrefix(onlinePlayer);
|
||||
tag.setPrefix(onlinePlayer, onlinePlayerPrefix.getContent());
|
||||
tag.setOrder(onlinePlayer, descOrder ? 999 - onlinePlayerPrefix.getWeight() : onlinePlayerPrefix.getWeight());
|
||||
Main.debug("为玩家 " + player.getName() + " 设置了 " + onlinePlayer.getName() + "的前缀为 #" + onlinePlayerPrefix.getWeight() + " " + onlinePlayerPrefix.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!UserManager.isPrefixUsable(player, currentPrefixData)) {
|
||||
ConfiguredPrefix currentPrefix = PrefixManager.getPrefix(currentPrefixData);
|
||||
ConfiguredPrefix newPrefix = UserManager.getHighestPrefix(player);
|
||||
/**
|
||||
* 检查玩家的前缀的使用权
|
||||
*
|
||||
* @param player 玩家
|
||||
* @param updateView 是否更新头顶与TabList中的前缀
|
||||
*/
|
||||
public static void checkPrefix(Player player, boolean updateView) {
|
||||
if (checkingPlayers.contains(player.getUniqueId())) {
|
||||
/*
|
||||
* 这里为了避免极短时间内的重复触发导致多次判断且结果相同误导玩家,
|
||||
* 故没有采用同步锁,而是采用添加到一个临时Set中,对Set中玩家跳过判断。
|
||||
*/
|
||||
return;
|
||||
}
|
||||
checkingPlayers.add(player.getUniqueId());
|
||||
String currentPrefixData = UserManager.getPrefixData(player);
|
||||
|
||||
if (currentPrefix != null) {
|
||||
//当前前缀不为空,则代表属于前缀过期的情况
|
||||
Bukkit.getPluginManager().callEvent(new UserPrefixExpireEvent(player, currentPrefix));
|
||||
if (!UserManager.isPrefixUsable(player, currentPrefixData)) {
|
||||
ConfiguredPrefix currentPrefix = PrefixManager.getPrefix(currentPrefixData);
|
||||
ConfiguredPrefix newPrefix = UserManager.getHighestPrefix(player);
|
||||
|
||||
// 发送消息
|
||||
PluginConfig.Messages.EXPIRED.sendWithPlaceholders(player,
|
||||
new String[]{"%(newName)", "%(oldName)"},
|
||||
new Object[]{newPrefix.getName(), currentPrefix.getName()}
|
||||
);
|
||||
if (currentPrefix != null) {
|
||||
//当前前缀不为空,则代表属于前缀过期的情况
|
||||
UserPrefixExpireEvent.call(player, currentPrefix);
|
||||
|
||||
// 播放声音
|
||||
PluginConfig.Sounds.PREFIX_EXPIRED.play(player);
|
||||
} else {
|
||||
// 当前前缀为空,则代表是旧的前缀不存在了,
|
||||
PluginConfig.Messages.REMOVED.sendWithPlaceholders(player,
|
||||
new String[]{"%(newName)", "%(oldName)"},
|
||||
new Object[]{newPrefix.getName(), currentPrefixData}
|
||||
);
|
||||
}
|
||||
// 发送消息
|
||||
PluginConfig.Messages.EXPIRED.sendWithPlaceholders(player,
|
||||
new String[]{"%(newName)", "%(oldName)"},
|
||||
new Object[]{newPrefix.getName(), currentPrefix.getName()}
|
||||
);
|
||||
|
||||
UserPrefixChangeEvent event = new UserPrefixChangeEvent(player, currentPrefix, newPrefix);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
// 播放声音
|
||||
PluginConfig.Sounds.PREFIX_EXPIRED.play(player);
|
||||
} else {
|
||||
// 当前前缀为空,则代表是旧的前缀不存在了,
|
||||
PluginConfig.Messages.REMOVED.sendWithPlaceholders(player,
|
||||
new String[]{"%(newName)", "%(oldName)"},
|
||||
new Object[]{newPrefix.getName(), currentPrefixData}
|
||||
);
|
||||
}
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
// 更新前缀
|
||||
UserManager.setPrefix(player, event.getAfter(), updateView);
|
||||
}
|
||||
UserPrefixChangeEvent.call(player, currentPrefix, newPrefix, (after) -> {
|
||||
if (after != null) {
|
||||
UserManager.setPrefix(player, after, updateView);
|
||||
}
|
||||
checkingPlayers.remove(player.getUniqueId());
|
||||
});
|
||||
|
||||
}
|
||||
} else {
|
||||
checkingPlayers.remove(player.getUniqueId());
|
||||
}
|
||||
}
|
||||
|
||||
checkingPlayers.remove(player.getUniqueId());
|
||||
}
|
||||
public static void unloadNameTag(UUID uuid) {
|
||||
nameTags.remove(uuid);
|
||||
}
|
||||
|
||||
public static void unloadNameTag(UUID uuid) {
|
||||
nameTags.remove(uuid);
|
||||
}
|
||||
/**
|
||||
* 得到玩家的前缀。
|
||||
* 该方法会自动判断玩家当前的前缀是否可用,并返回最终可用的前缀。
|
||||
*
|
||||
* @param player 玩家
|
||||
* @return 前缀配置
|
||||
*/
|
||||
@NotNull
|
||||
public static ConfiguredPrefix getPrefix(Player player) {
|
||||
String identifier = getPrefixData(player);
|
||||
if (identifier == null || !isPrefixUsable(player, identifier)) {
|
||||
return getHighestPrefix(player);
|
||||
} else {
|
||||
ConfiguredPrefix prefix = PrefixManager.getPrefix(identifier);
|
||||
return prefix == null ? PrefixManager.getDefaultPrefix() : prefix;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 得到玩家的前缀。
|
||||
* 该方法会自动判断玩家当前的前缀是否可用,并返回最终可用的前缀。
|
||||
*
|
||||
* @param player 玩家
|
||||
* @return 前缀配置
|
||||
*/
|
||||
@NotNull
|
||||
public static ConfiguredPrefix getPrefix(Player player) {
|
||||
String identifier = getPrefixData(player);
|
||||
if (identifier == null || !isPrefixUsable(player, identifier)) {
|
||||
return getHighestPrefix(player);
|
||||
} else {
|
||||
ConfiguredPrefix prefix = PrefixManager.getPrefix(identifier);
|
||||
return prefix == null ? PrefixManager.getDefaultPrefix() : prefix;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 设定玩家前缀
|
||||
*
|
||||
* @param player 玩家
|
||||
* @param prefix 前缀配置
|
||||
* @param updateView 是否更新头顶上、TabList的前缀
|
||||
*/
|
||||
public static void setPrefix(Player player, ConfiguredPrefix prefix, boolean updateView) {
|
||||
setPrefixData(player, prefix.getIdentifier());
|
||||
if (updateView) updatePrefixView(player, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设定玩家前缀
|
||||
*
|
||||
* @param player 玩家
|
||||
* @param prefix 前缀配置
|
||||
* @param updateView 是否更新头顶上、TabList的前缀
|
||||
*/
|
||||
public static void setPrefix(Player player, ConfiguredPrefix prefix, boolean updateView) {
|
||||
setPrefixData(player, prefix.getIdentifier());
|
||||
if (updateView) updatePrefixView(player, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 得到玩家所有可用的前缀
|
||||
*
|
||||
* @param player 玩家
|
||||
* @return 可用前缀列表
|
||||
*/
|
||||
@NotNull
|
||||
public static List<ConfiguredPrefix> getUsablePrefixes(Player player) {
|
||||
return PrefixManager.getPrefixes().values().stream()
|
||||
.filter(configuredPrefix -> isPrefixUsable(player, configuredPrefix)) //过滤出玩家可用的前缀
|
||||
.sorted(Comparator.comparingInt(ConfiguredPrefix::getWeight)) // 以前缀排序
|
||||
.collect(Collectors.toList()); // 返回集合
|
||||
}
|
||||
/**
|
||||
* 得到玩家所有可用的前缀
|
||||
*
|
||||
* @param player 玩家
|
||||
* @return 可用前缀列表
|
||||
*/
|
||||
@NotNull
|
||||
public static List<ConfiguredPrefix> getUsablePrefixes(Player player) {
|
||||
return PrefixManager.getPrefixes().values().stream()
|
||||
.filter(configuredPrefix -> isPrefixUsable(player, configuredPrefix)) //过滤出玩家可用的前缀
|
||||
.sorted(Comparator.comparingInt(ConfiguredPrefix::getWeight)) // 以前缀排序
|
||||
.collect(Collectors.toList()); // 返回集合
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 得到玩家可使用的最高权重的权限
|
||||
* 注意:若配置文件中关闭了 “autoUsePrefix” ,则会返回默认前缀。
|
||||
*
|
||||
* @param player 玩家
|
||||
* @return 权限内容
|
||||
*/
|
||||
@NotNull
|
||||
public static ConfiguredPrefix getHighestPrefix(Player player) {
|
||||
if (PluginConfig.Functions.AUTO_USE.get()) {
|
||||
// 关闭了自动选择,就直接给默认的前缀,让玩家自己去设置吧~
|
||||
return PrefixManager.getDefaultPrefix();
|
||||
}
|
||||
return getUsablePrefixes(player).stream()
|
||||
.max(Comparator.comparingInt(ConfiguredPrefix::getWeight)) // 取权重最大
|
||||
.orElseGet(PrefixManager::getDefaultPrefix); // 啥都没有? 返回默认前缀。
|
||||
}
|
||||
/**
|
||||
* 得到玩家可使用的最高权重的权限
|
||||
* 注意:若配置文件中关闭了 “autoUsePrefix” ,则会返回默认前缀。
|
||||
*
|
||||
* @param player 玩家
|
||||
* @return 权限内容
|
||||
*/
|
||||
@NotNull
|
||||
public static ConfiguredPrefix getHighestPrefix(Player player) {
|
||||
if (PluginConfig.Functions.AUTO_USE.get()) {
|
||||
// 关闭了自动选择,就直接给默认的前缀,让玩家自己去设置吧~
|
||||
return PrefixManager.getDefaultPrefix();
|
||||
}
|
||||
return getUsablePrefixes(player).stream()
|
||||
.max(Comparator.comparingInt(ConfiguredPrefix::getWeight)) // 取权重最大
|
||||
.orElseGet(PrefixManager::getDefaultPrefix); // 啥都没有? 返回默认前缀。
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断一个前缀对某玩家是否可用
|
||||
*
|
||||
* @param player 玩家
|
||||
* @param prefixIdentifier 前缀标识
|
||||
* @return 若前缀标识不存在,则返回false;若前缀为默认前缀,或该前缀无权限,或玩家有该前缀的权限,则返回true。
|
||||
*/
|
||||
public static boolean isPrefixUsable(Player player, String prefixIdentifier) {
|
||||
if (prefixIdentifier == null || prefixIdentifier.equalsIgnoreCase("default")) return true;
|
||||
ConfiguredPrefix prefix = PrefixManager.getPrefix(prefixIdentifier);
|
||||
if (prefix == null) return false;
|
||||
return isPrefixUsable(player, prefix);
|
||||
}
|
||||
/**
|
||||
* 判断一个前缀对某玩家是否可用
|
||||
*
|
||||
* @param player 玩家
|
||||
* @param prefixIdentifier 前缀标识
|
||||
* @return 若前缀标识不存在,则返回false;若前缀为默认前缀,或该前缀无权限,或玩家有该前缀的权限,则返回true。
|
||||
*/
|
||||
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
|
||||
public static boolean isPrefixUsable(Player player, String prefixIdentifier) {
|
||||
if (prefixIdentifier == null || prefixIdentifier.equalsIgnoreCase("default")) return true;
|
||||
ConfiguredPrefix prefix = PrefixManager.getPrefix(prefixIdentifier);
|
||||
if (prefix == null) return false;
|
||||
return isPrefixUsable(player, prefix);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断一个前缀对某玩家是否可用
|
||||
*
|
||||
* @param player 玩家
|
||||
* @param configuredPrefix 前缀配置
|
||||
* @return 若前缀标识不存在,则返回false;若前缀为默认前缀,或该前缀无权限,或玩家有该前缀的权限,则返回true。
|
||||
*/
|
||||
public static boolean isPrefixUsable(Player player, ConfiguredPrefix configuredPrefix) {
|
||||
return configuredPrefix.isPublic()
|
||||
|| ServiceManager.hasPermission(ServiceManager.getUser(player), configuredPrefix.getPermission());
|
||||
}
|
||||
/**
|
||||
* 判断一个前缀对某玩家是否可用
|
||||
*
|
||||
* @param player 玩家
|
||||
* @param configuredPrefix 前缀配置
|
||||
* @return 若前缀标识不存在,则返回false;若前缀为默认前缀,或该前缀无权限,或玩家有该前缀的权限,则返回true。
|
||||
*/
|
||||
public static boolean isPrefixUsable(Player player, ConfiguredPrefix configuredPrefix) {
|
||||
return configuredPrefix.isPublic()
|
||||
|| ServiceManager.hasPermission(ServiceManager.getUser(player), configuredPrefix.getPermission());
|
||||
}
|
||||
|
||||
/**
|
||||
* 得到用户当前正在使用的前缀Identifier。
|
||||
* 该方法通过LuckPerms的MetaData实现,因此可以通过指令去操作。
|
||||
*
|
||||
* @param player 玩家
|
||||
* @return 正在使用的前缀Identifier(若不存在则返回null, 代表未设置前缀)
|
||||
*/
|
||||
@Nullable
|
||||
public static String getPrefixData(Player player) {
|
||||
return ServiceManager.getAPI().getMetaData(player)
|
||||
.getMetaValue("userprefix", String::valueOf)
|
||||
.orElse(null);
|
||||
}
|
||||
/**
|
||||
* 得到用户当前正在使用的前缀Identifier。
|
||||
* 该方法通过LuckPerms的MetaData实现,因此可以通过指令去操作。
|
||||
*
|
||||
* @param player 玩家
|
||||
* @return 正在使用的前缀Identifier(若不存在则返回null, 代表未设置前缀)
|
||||
*/
|
||||
@Nullable
|
||||
public static String getPrefixData(Player player) {
|
||||
return ServiceManager.getAPI().getMetaData(player)
|
||||
.getMetaValue("userprefix", String::valueOf)
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设定用户所使用的的prefix。
|
||||
* 该方法通过LuckPerms的MetaData实现,因此可以通过指令去操作。
|
||||
*
|
||||
* @param player 玩家
|
||||
* @param prefixIdentifier 前缀的标识
|
||||
*/
|
||||
public static void setPrefixData(Player player, String prefixIdentifier) {
|
||||
User user = ServiceManager.getUser(player);
|
||||
clearPrefixData(player); // 清除掉旧的数据,LuckPerms不会去覆盖一个Meta,需要手动清除。
|
||||
if (prefixIdentifier != null) {
|
||||
user.data().add(MetaNode.builder("userprefix", prefixIdentifier).build());
|
||||
ServiceManager.getService().getUserManager().saveUser(user); // 保存数据
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 设定用户所使用的的prefix。
|
||||
* 该方法通过LuckPerms的MetaData实现,因此可以通过指令去操作。
|
||||
*
|
||||
* @param player 玩家
|
||||
* @param prefixIdentifier 前缀的标识
|
||||
*/
|
||||
public static void setPrefixData(Player player, String prefixIdentifier) {
|
||||
User user = ServiceManager.getUser(player);
|
||||
clearPrefixData(player); // 清除掉旧的数据,LuckPerms不会去覆盖一个Meta,需要手动清除。
|
||||
if (prefixIdentifier != null) {
|
||||
user.data().add(MetaNode.builder("userprefix", prefixIdentifier).build());
|
||||
ServiceManager.getService().getUserManager().saveUser(user); // 保存数据
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除玩家所选择的前缀数据
|
||||
*
|
||||
* @param player 玩家
|
||||
*/
|
||||
public static void clearPrefixData(Player player) {
|
||||
User user = ServiceManager.getUser(player);
|
||||
// LuckPerms竟然会把所有的metaKey全部转换为小写... 那我这里就直接写成小写吧~
|
||||
user.data().clear(NodeType.META.predicate(mn -> mn.getMetaKey().equals("userprefix")));
|
||||
}
|
||||
/**
|
||||
* 清除玩家所选择的前缀数据
|
||||
*
|
||||
* @param player 玩家
|
||||
*/
|
||||
public static void clearPrefixData(Player player) {
|
||||
User user = ServiceManager.getUser(player);
|
||||
// LuckPerms竟然会把所有的metaKey全部转换为小写... 那我这里就直接写成小写吧~
|
||||
user.data().clear(NodeType.META.predicate(mn -> mn.getMetaKey().equals("userprefix")));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package cc.carm.plugin.userprefix.model;
|
||||
|
||||
import cc.carm.plugin.userprefix.util.ColorParser;
|
||||
import cc.carm.plugin.userprefix.util.ConfigurationUtil;
|
||||
import cc.carm.plugin.userprefix.util.ItemStackFactory;
|
||||
import cc.carm.plugin.userprefix.util.MessageUtil;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
@@ -38,7 +38,11 @@ public class ConfiguredPrefix {
|
||||
|
||||
public ConfiguredPrefix(@NotNull File dataFile) {
|
||||
this.dataFile = dataFile;
|
||||
this.configuration = YamlConfiguration.loadConfiguration(dataFile);
|
||||
try {
|
||||
this.configuration = ConfigurationUtil.bang(dataFile);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (getConfiguration() != null) {
|
||||
this.identifier = getConfiguration().getString("identifier", "ERROR");
|
||||
this.name = getConfiguration().getString("name", "ERROR");
|
||||
|
||||
@@ -4,6 +4,7 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scoreboard.Scoreboard;
|
||||
import org.bukkit.scoreboard.Team;
|
||||
import org.jetbrains.annotations.Range;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -12,10 +13,12 @@ import java.util.UUID;
|
||||
|
||||
public class UserNameTag {
|
||||
|
||||
public static final int MAX_ORDER = 999;
|
||||
|
||||
private final Player viewer;
|
||||
private Team team;
|
||||
private final Scoreboard sb;
|
||||
private int order = 99999;
|
||||
private int order = MAX_ORDER;
|
||||
private final Map<UUID, Integer> targetOrders = new HashMap<>();
|
||||
private final Map<UUID, String> previousTeamNames = new HashMap<>();
|
||||
|
||||
@@ -35,7 +38,7 @@ public class UserNameTag {
|
||||
/**
|
||||
* 设置自己的前缀
|
||||
*
|
||||
* @param prefix
|
||||
* @param prefix 前缀内容
|
||||
*/
|
||||
public void setPrefix(String prefix) {
|
||||
team.setPrefix(prefix);
|
||||
@@ -45,8 +48,8 @@ public class UserNameTag {
|
||||
/**
|
||||
* 设置某个玩家的前缀
|
||||
*
|
||||
* @param target
|
||||
* @param prefix
|
||||
* @param target 目标
|
||||
* @param prefix 前缀内容
|
||||
*/
|
||||
public void setPrefix(Player target, String prefix) {
|
||||
if (target == viewer) {
|
||||
@@ -63,11 +66,9 @@ public class UserNameTag {
|
||||
/**
|
||||
* 设置名字在TabList中的顺序
|
||||
*
|
||||
* @param order
|
||||
* @param order 顺序 (0~999)
|
||||
*/
|
||||
public void setOrder(int order) {
|
||||
if (order < 0 || order > 99999)
|
||||
throw new IllegalArgumentException("order must be in 0~99999");
|
||||
public void setOrder(@Range(from = 0, to = 999) int order) {
|
||||
this.order = order;
|
||||
targetOrders.put(viewer.getUniqueId(), order);
|
||||
update(viewer);
|
||||
@@ -78,16 +79,13 @@ public class UserNameTag {
|
||||
*
|
||||
* @param order 顺序
|
||||
*/
|
||||
public void setOrder(Player target, int order) {
|
||||
if (order < 0 || order > 99999)
|
||||
throw new IllegalArgumentException("order must be in 0~99999");
|
||||
public void setOrder(Player target, @Range(from = 0, to = 999) int order) {
|
||||
Team targetTeam = checkTeam(target);
|
||||
String teamName = order + UUID.randomUUID().toString().substring(0, 10);
|
||||
targetTeam.setDisplayName(teamName);
|
||||
targetOrders.put(target.getUniqueId(), order);
|
||||
update(viewer);
|
||||
if (viewer != target)
|
||||
update(target);
|
||||
if (viewer != target) update(target);
|
||||
}
|
||||
|
||||
public void update(Player target) {
|
||||
@@ -110,7 +108,7 @@ public class UserNameTag {
|
||||
team = newTeam;
|
||||
}
|
||||
} else {
|
||||
int order = targetOrders.getOrDefault(target.getUniqueId(), 99999);
|
||||
int order = targetOrders.getOrDefault(target.getUniqueId(), 999);
|
||||
String previousTeamName = previousTeamNames.get(target.getUniqueId());
|
||||
if (previousTeamName == null) {
|
||||
return;
|
||||
@@ -138,7 +136,7 @@ public class UserNameTag {
|
||||
}
|
||||
|
||||
private Team checkTeam(Player target) {
|
||||
int order = targetOrders.getOrDefault(target.getUniqueId(), 99999);
|
||||
int order = targetOrders.getOrDefault(target.getUniqueId(), 999);
|
||||
String name = order + target.getUniqueId().toString().substring(0, 10);
|
||||
Team targetTeam = this.sb.getTeam(name);
|
||||
if (targetTeam == null) {
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package cc.carm.plugin.userprefix.util;
|
||||
|
||||
import cc.carm.plugin.userprefix.wrapper.ItemStackWrapper;
|
||||
import com.google.common.io.Files;
|
||||
import org.bukkit.configuration.InvalidConfigurationException;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.StringJoiner;
|
||||
|
||||
public class ConfigurationUtil {
|
||||
public static FileConfiguration bang(File file) {
|
||||
YamlConfiguration conf = new YamlConfiguration();
|
||||
StringJoiner builder = new StringJoiner("\n");
|
||||
try {
|
||||
//noinspection UnstableApiUsage
|
||||
Files.readLines(file, StandardCharsets.UTF_8).forEach(builder::add);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return conf;
|
||||
}
|
||||
String tmpConf = builder.toString().replace("==: "+ ItemStack.class.getName(), "==: "+ ItemStackWrapper.class.getName());
|
||||
try {
|
||||
conf.loadFromString(tmpConf);
|
||||
} catch (InvalidConfigurationException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return conf;
|
||||
}
|
||||
|
||||
public static String dong(FileConfiguration conf) {
|
||||
return conf.saveToString().replace("==: "+ ItemStackWrapper.class.getName(),"==: "+ ItemStack.class.getName());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package cc.carm.plugin.userprefix.wrapper;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.serialization.ConfigurationSerializable;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class ItemStackWrapper implements ConfigurationSerializable {
|
||||
private static boolean unsafeAvailable;
|
||||
|
||||
static {
|
||||
try {
|
||||
Class.forName("org.bukkit.UnsafeValues");
|
||||
unsafeAvailable = true;
|
||||
} catch (ClassNotFoundException e) {
|
||||
unsafeAvailable = false;
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Map<String, Object> serialize() {
|
||||
throw new UnsupportedOperationException("Use ConfigurationUtil#dong to save configuration");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static ItemStack deserialize(@NotNull Map<String, Object> args) {
|
||||
// static define will cause problem, lazy load it
|
||||
if (unsafeAvailable) {
|
||||
if (!args.containsKey("v")) {
|
||||
Material material = Material.matchMaterial(args.get("type").toString());
|
||||
if (material == null) {
|
||||
throw new IllegalArgumentException("物品 "+args.get("type")+" 不存在");
|
||||
}
|
||||
args.put("v", Bukkit.getServer().getUnsafe().getDataVersion());
|
||||
}
|
||||
}
|
||||
return ItemStack.deserialize(args);
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,11 @@ debug: false
|
||||
# 当然,您也可以选择在这里关闭,或在plugins/bStats下的配置文件中关闭。
|
||||
metrics: true
|
||||
|
||||
# 检查更新设定
|
||||
# 该选项用于插件判断是否要检查更新,若您不希望插件检查更新并提示您,可以选择关闭。
|
||||
# 检查更新为异步操作,绝不会影响性能与使用体验。
|
||||
check-update: true
|
||||
|
||||
custom-storage:
|
||||
# 自定义存储位置
|
||||
# 默认存储位置为 “插件文件夹”/prefixes
|
||||
@@ -16,8 +21,11 @@ custom-storage:
|
||||
path: "prefixes/" # 一定要指向一个文件夹!
|
||||
|
||||
functions:
|
||||
OnNamePrefix: true # 是否给头顶上添加前缀,该方法用到了头顶的那个计分板,如有冲突请关掉哦~
|
||||
autoUsePrefix: true # 自动前缀显示 当玩家没有自己选择一个前缀的时候,会自动使用所拥有的的前缀中权重最高的那一个
|
||||
# 头顶与TabList前缀功能,该方法用到了玩家名计分板接口,如有冲突请关掉哦~
|
||||
on-name-prefix:
|
||||
enable: true # 是否开启本功能
|
||||
order-desc: true # 是否按降序排列,即权重越高的前缀显示在越上面;若为false则按升序排列。
|
||||
auto-prefix-use: true # 自动使用前缀,即当玩家没有自己选择一个前缀的时候,会自动使用所拥有的的前缀中权重最高的那一个
|
||||
chat:
|
||||
# 聊天功能
|
||||
# - 我不推荐使用本插件的聊天功能,而是建议使用其他的聊天插件。
|
||||
|
||||
@@ -4,6 +4,9 @@ debug: false #DEBUG OUT PUT
|
||||
|
||||
metrics: true #Metrics stats (to help developer know the stats)
|
||||
|
||||
# Auto check the updates.
|
||||
check-update: true
|
||||
|
||||
custom-storage:
|
||||
# Custom storage location
|
||||
# default location is "./prefixes"
|
||||
@@ -36,14 +39,16 @@ GUI:
|
||||
- "§fRight-Click to the first page"
|
||||
|
||||
functions:
|
||||
# Whether to add a prefix to the top of the head,
|
||||
# Add a prefix to the top of the head,
|
||||
# this method uses the scoreboard above the head,
|
||||
# please turn it off if there is a conflict.
|
||||
OnNamePrefix: true
|
||||
on-name-prefix:
|
||||
enable: true # enable or disable
|
||||
order-desc: true # using desc ( higher weight for higher display in TabList)
|
||||
# Automatic prefix select.
|
||||
# When the player does not choose a prefix by himself,
|
||||
# the prefix with the highest weight will be used automatically
|
||||
autoUsePrefix: true
|
||||
auto-prefix-use: true
|
||||
chat:
|
||||
# Chat Function
|
||||
# - I recommend using other chat plugins instead of using this plugin,
|
||||
|
||||
@@ -7,6 +7,7 @@ authors:
|
||||
- SakuraGame
|
||||
website: ${project.url}
|
||||
description: ${project.description}
|
||||
api-version: 1.13
|
||||
|
||||
depend:
|
||||
- LuckPerms
|
||||
@@ -22,4 +23,4 @@ commands:
|
||||
- upa
|
||||
- prefixAdmin
|
||||
permission: "UserPrefix.admin"
|
||||
description: "用户前缀系统管理指令,可以查看前缀列表与重载配置文件。"
|
||||
description: "用户前缀系统管理指令,可以查看前缀列表与重载配置文件。"
|
||||
|
||||
@@ -14,7 +14,7 @@ content: "&b&lPro &b"
|
||||
# 权重 [必须]
|
||||
# 用于GUI、TabList的排序和自动前缀显示
|
||||
# 在GUI中,权重越高的会显示在越后面
|
||||
# 在TabList中,权重越高的会显示在越上面
|
||||
# 在TabList中,显示顺序可以在 config.yml 中自定义
|
||||
weight: 1
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user