mirror of
https://github.com/CarmJos/UltraDepository.git
synced 2026-06-04 08:38:25 +08:00
[v1.1.3] 版本更新
- [U] 当物品不足时发送提示 - [A] 使用bStats进行数据统计
This commit is contained in:
@@ -15,6 +15,8 @@ import cc.carm.plugin.ultradepository.storage.MySQLStorage;
|
||||
import cc.carm.plugin.ultradepository.util.ColorParser;
|
||||
import cc.carm.plugin.ultradepository.util.MessageUtil;
|
||||
import cc.carm.plugin.ultradepository.util.SchedulerUtils;
|
||||
import org.bstats.bukkit.Metrics;
|
||||
import org.bstats.charts.SingleLineChart;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.PluginCommand;
|
||||
@@ -27,6 +29,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
public class Main extends JavaPlugin {
|
||||
|
||||
private static Main instance;
|
||||
private static Metrics metrics;
|
||||
private static SchedulerUtils scheduler;
|
||||
|
||||
private static DataStorage storage;
|
||||
@@ -94,6 +97,15 @@ public class Main extends JavaPlugin {
|
||||
log("检测到未安装PlaceholderAPI,跳过变量注册。");
|
||||
}
|
||||
|
||||
if (PluginConfig.METRICS.get()) {
|
||||
log("启用统计数据...");
|
||||
metrics = new Metrics(this, 13776);
|
||||
metrics.addCustomChart(new SingleLineChart(
|
||||
"active_depositories",
|
||||
() -> getDepositoryManager().getDepositories().size())
|
||||
);
|
||||
}
|
||||
|
||||
initialized = true;
|
||||
log("加载完成 ,共耗时 " + (System.currentTimeMillis() - startTime) + " ms 。");
|
||||
|
||||
|
||||
@@ -11,9 +11,14 @@ import org.bukkit.Material;
|
||||
public class PluginConfig {
|
||||
|
||||
public static final ConfigValue<Boolean> DEBUG = new ConfigValue<>(
|
||||
"debug", Boolean.class
|
||||
"debug", Boolean.class, false
|
||||
);
|
||||
|
||||
public static final ConfigValue<Boolean> METRICS = new ConfigValue<>(
|
||||
"metrics", Boolean.class, true
|
||||
);
|
||||
|
||||
|
||||
public static final ConfigValue<String> STORAGE_METHOD = new ConfigValue<>(
|
||||
"storage.method", String.class
|
||||
);
|
||||
|
||||
@@ -59,7 +59,11 @@ public class DepositoryGUI extends GUI {
|
||||
return new GUIItem(factory.toItemStack()) {
|
||||
@Override
|
||||
public void onClick(ClickType type) {
|
||||
if (itemData.getAmount() < 1) return;
|
||||
if (itemData.getAmount() < 1) {
|
||||
PluginMessages.NO_ENOUGH_ITEM.send(player);
|
||||
return;
|
||||
}
|
||||
|
||||
if (type == ClickType.LEFT) {
|
||||
player.closeInventory();
|
||||
if (itemData.getAmount() >= 1) {
|
||||
@@ -71,7 +75,6 @@ public class DepositoryGUI extends GUI {
|
||||
} else {
|
||||
PluginMessages.NO_ENOUGH_ITEM.send(player);
|
||||
}
|
||||
|
||||
} else if (type == ClickType.RIGHT) {
|
||||
player.closeInventory();
|
||||
if (hasEmptySlot(player)) {
|
||||
@@ -84,7 +87,6 @@ public class DepositoryGUI extends GUI {
|
||||
} else {
|
||||
PluginMessages.NO_SPACE.send(player);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -6,6 +6,11 @@ version: ${project.version}
|
||||
|
||||
debug: false
|
||||
|
||||
# 统计数据设定
|
||||
# 改选项用于帮助开发者统计插件版本与使用情况,且绝不会影响性能与使用体验。
|
||||
# 当然,您也可以选择在这里关闭,或在plugins/bStats下的配置文件中关闭。
|
||||
metrics: true
|
||||
|
||||
# 存储相关配置
|
||||
# 注意:存储配置不会通过重载指令生效,如有修改请重新启动服务器。
|
||||
storage:
|
||||
|
||||
Reference in New Issue
Block a user