mirror of
https://github.com/CarmJos/UserPrefix.git
synced 2024-09-19 20:15:47 +00:00
[v2.2.1] [U] 添加统计数据获取与开关设定。
This commit is contained in:
parent
42b71714aa
commit
7e4ca870b5
16
pom.xml
16
pom.xml
@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>cc.carm.plugin</groupId>
|
||||
<artifactId>userprefix</artifactId>
|
||||
<version>2.2.0</version>
|
||||
<version>2.2.1</version>
|
||||
|
||||
<name>UserPrefix</name>
|
||||
<description>轻便、高效、实时的用户前缀系统。</description>
|
||||
@ -120,6 +120,13 @@
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.bstats</groupId>
|
||||
<artifactId>bstats-bukkit</artifactId>
|
||||
<version>2.2.1</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
@ -199,6 +206,13 @@
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<relocations>
|
||||
<relocation>
|
||||
<pattern>org.bstats</pattern>
|
||||
<!-- Replace this with your package! -->
|
||||
<shadedPattern>cc.carm.plugin.userprefix.bstats</shadedPattern>
|
||||
</relocation>
|
||||
</relocations>
|
||||
<filters>
|
||||
<filter>
|
||||
<artifact>*:*</artifact>
|
||||
|
@ -14,6 +14,8 @@ import cc.carm.plugin.userprefix.manager.UserManager;
|
||||
import cc.carm.plugin.userprefix.util.ColorParser;
|
||||
import cc.carm.plugin.userprefix.util.MessageUtil;
|
||||
import net.luckperms.api.event.user.UserDataRecalculateEvent;
|
||||
import org.bstats.bukkit.Metrics;
|
||||
import org.bstats.charts.SingleLineChart;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.PluginCommand;
|
||||
@ -26,6 +28,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
public class Main extends JavaPlugin {
|
||||
|
||||
private static Main instance;
|
||||
private static Metrics metrics;
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
@ -55,6 +58,11 @@ public class Main extends JavaPlugin {
|
||||
log("若您想使用变量进行前缀的显示,请安装PlaceholderAPI!");
|
||||
}
|
||||
|
||||
if (PrefixConfig.METRICS.get()) {
|
||||
log("启用统计数据...");
|
||||
metrics = new Metrics(this, 13776);
|
||||
metrics.addCustomChart(new SingleLineChart("active_prefixes", () -> PrefixManager.getPrefixes().size()));
|
||||
}
|
||||
|
||||
log("加载完成 ,共耗时 " + (System.currentTimeMillis() - startTime) + " ms 。");
|
||||
|
||||
@ -64,6 +72,7 @@ public class Main extends JavaPlugin {
|
||||
Bukkit.getOnlinePlayers().forEach(UserManager::initPlayer); // 适配热重载
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -9,73 +9,75 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class PrefixConfig {
|
||||
|
||||
public static ConfigValue<Boolean> DEBUG = new ConfigValue<>("debug", Boolean.class, false);
|
||||
public static ConfigValue<Boolean> DEBUG = new ConfigValue<>("debug", Boolean.class, false);
|
||||
|
||||
public static class CustomStorage {
|
||||
public static ConfigValue<Boolean> METRICS = new ConfigValue<>("metrics", 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.OnNamePrefix", Boolean.class, true);
|
||||
public static ConfigValue<Boolean> AUTO_USE = new ConfigValue<>("functions.autoUsePrefix", 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 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 GUI {
|
||||
|
||||
public static class Items {
|
||||
public static ConfigValue<String> TITLE = new ConfigValue<>("GUI.title", String.class, "&f&l我的前缀 &8| 列表");
|
||||
|
||||
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 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 class Messages {
|
||||
|
||||
public static ConfigMessageList RELOAD = new ConfigMessageList("reload");
|
||||
public static ConfigMessageList HELP = new ConfigMessageList("help");
|
||||
public static ConfigMessageList SELECTED = new ConfigMessageList("selected");
|
||||
public static ConfigMessageList EXPIRED = new ConfigMessageList("expired");
|
||||
|
||||
public static ConfigMessageList LIST_TITLE = new ConfigMessageList("list-title");
|
||||
public static ConfigMessageList LIST_VALUE = new ConfigMessageList("list-value");
|
||||
}
|
||||
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");
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -2,6 +2,11 @@ version: ${project.version} #配置文件版本,若与插件版本不同请记
|
||||
|
||||
debug: false
|
||||
|
||||
# 统计数据设定
|
||||
# 改选项用于帮助开发者统计插件版本与使用情况,且绝不会影响性能与使用体验。
|
||||
# 当然,您也可以选择在这里关闭,或在plugins/bStats下的配置文件中关闭。
|
||||
metrics: true
|
||||
|
||||
custom-storage:
|
||||
# 自定义存储位置
|
||||
# 默认存储位置为 “插件文件夹”/prefixes
|
||||
|
Loading…
Reference in New Issue
Block a user