This commit is contained in:
YuTian 2024-07-14 23:01:47 +08:00
parent f60464ffc6
commit ec3a712212
9 changed files with 107 additions and 103 deletions

View File

@ -29,7 +29,7 @@ public class Main extends JavaPlugin {
@Override
public void onDisable() {
rechargeManage.SaveData();
consumeManage.SaveData();
rechargeManage.saveData();
consumeManage.saveData();
}
}

View File

@ -49,15 +49,15 @@ public class RechargeExpansion extends PlaceholderExpansion {
public String onPlaceholderRequest(Player player, String identifier) {
if (identifier.equalsIgnoreCase("day")) {
String playerName = player.getName();
int val = RechargeAPI.getRechargeData(playerName, TimeType.Daily);
int val = RechargeAPI.getRechargeData(playerName, TimeType.DAILY);
return String.valueOf(val);
}else if (identifier.equalsIgnoreCase("month")) {
String playerName = player.getName();
int val = RechargeAPI.getRechargeData(playerName, TimeType.Monthly);
int val = RechargeAPI.getRechargeData(playerName, TimeType.MONTHLY);
return String.valueOf(val);
}else if (identifier.equalsIgnoreCase("me")) {
String playerName = player.getName();
int val = RechargeAPI.getRechargeData(playerName, TimeType.Annual);
int val = RechargeAPI.getRechargeData(playerName, TimeType.ANNUAL);
return String.valueOf(val);
} else {
String[] sp = identifier.split("_");

View File

@ -17,12 +17,12 @@ public abstract class RechargeAPI {
PlayerData dataAPI = manage.getPlayerData(name); // 获取玩家的充值数据实例
// 根据时间类型获取玩家的累积充值数据
switch (timeType) {
case Daily:
return dataAPI.getValueData(TimeType.Daily); // 获取每日累积充值数据
case Monthly:
return dataAPI.getValueData(TimeType.Monthly); // 获取每月累积充值数据
case Annual:
return dataAPI.getValueData(TimeType.Annual); // 获取年度累积充值数据
case DAILY:
return dataAPI.getValueData(TimeType.DAILY); // 获取每日累积充值数据
case MONTHLY:
return dataAPI.getValueData(TimeType.MONTHLY); // 获取每月累积充值数据
case ANNUAL:
return dataAPI.getValueData(TimeType.ANNUAL); // 获取年度累积充值数据
default:
return -1; // 如果时间类型不匹配则返回默认值或进行适当处理
}
@ -32,40 +32,40 @@ public abstract class RechargeAPI {
RechargeManage manage = Main.rechargeManage; // 获取充值管理实例
PlayerData dataAPI = manage.getPlayerData(name); // 获取玩家的充值数据实例
// 设置玩家的每日每月和年度充值数据为指定金额
dataAPI.setValueData(TimeType.Daily, money); // 设置每日充值数据
dataAPI.setValueData(TimeType.Monthly, money); // 设置每月充值数据
dataAPI.setValueData(TimeType.Annual, money); // 设置年度充值数据
dataAPI.setValueData(TimeType.DAILY, money); // 设置每日充值数据
dataAPI.setValueData(TimeType.MONTHLY, money); // 设置每月充值数据
dataAPI.setValueData(TimeType.ANNUAL, money); // 设置年度充值数据
}
// 增加累积充值金额
public static void addRechargeData(String name, int money) {
RechargeManage manage = Main.rechargeManage; // 获取充值管理实例
PlayerData dataAPI = manage.getPlayerData(name); // 获取玩家的充值数据实例
// 向玩家的每日每月和年度充值数据中添加指定金额
dataAPI.addValueData(TimeType.Daily, money); // 增加每日充值数据
dataAPI.addValueData(TimeType.Monthly, money); // 增加每月充值数据
dataAPI.addValueData(TimeType.Annual, money); // 增加年度充值数据
dataAPI.addValueData(TimeType.DAILY, money); // 增加每日充值数据
dataAPI.addValueData(TimeType.MONTHLY, money); // 增加每月充值数据
dataAPI.addValueData(TimeType.ANNUAL, money); // 增加年度充值数据
}
public static void takeRechargeData(String name, int money) {
RechargeManage manage = Main.rechargeManage; // 获取充值管理实例
PlayerData dataAPI = manage.getPlayerData(name); // 获取玩家的充值数据实例
// 减少玩家的每日每月和年度充值数据
int currentDaily = dataAPI.getValueData(TimeType.Daily);
int currentDaily = dataAPI.getValueData(TimeType.DAILY);
if (currentDaily >= money) {
dataAPI.setValueData(TimeType.Daily, currentDaily - money); // 减少每日充值数据
dataAPI.setValueData(TimeType.DAILY, currentDaily - money); // 减少每日充值数据
} else {
dataAPI.setValueData(TimeType.Daily, 0); // 如果减少金额大于当前累积值设为0
dataAPI.setValueData(TimeType.DAILY, 0); // 如果减少金额大于当前累积值设为0
}
int currentMonthly = dataAPI.getValueData(TimeType.Monthly);
int currentMonthly = dataAPI.getValueData(TimeType.MONTHLY);
if (currentMonthly >= money) {
dataAPI.setValueData(TimeType.Monthly, currentMonthly - money); // 减少每月充值数据
dataAPI.setValueData(TimeType.MONTHLY, currentMonthly - money); // 减少每月充值数据
} else {
dataAPI.setValueData(TimeType.Monthly, 0); // 如果减少金额大于当前累积值设为0
dataAPI.setValueData(TimeType.MONTHLY, 0); // 如果减少金额大于当前累积值设为0
}
int currentAnnual = dataAPI.getValueData(TimeType.Annual);
int currentAnnual = dataAPI.getValueData(TimeType.ANNUAL);
if (currentAnnual >= money) {
dataAPI.setValueData(TimeType.Annual, currentAnnual - money); // 减少年度充值数据
dataAPI.setValueData(TimeType.ANNUAL, currentAnnual - money); // 减少年度充值数据
} else {
dataAPI.setValueData(TimeType.Annual, 0); // 如果减少金额大于当前累积值设为0
dataAPI.setValueData(TimeType.ANNUAL, 0); // 如果减少金额大于当前累积值设为0
}
}
@ -74,15 +74,15 @@ public abstract class RechargeAPI {
RechargeManage manage = Main.rechargeManage; // 获取充值管理实例
PlayerData dataAPI = manage.getPlayerData(name); // 获取玩家的充值数据实例
// 根据时间类型向玩家的充值数据中添加指定金额
if (timeType == TimeType.Daily) {
dataAPI.addValueData(TimeType.Daily, money); // 增加每日充值数据
dataAPI.addValueData(TimeType.Monthly, money); // 增加每月充值数据
dataAPI.addValueData(TimeType.Annual, money); // 增加年度充值数据
} else if (timeType == TimeType.Monthly) {
dataAPI.addValueData(TimeType.Monthly, money); // 增加每月充值数据
dataAPI.addValueData(TimeType.Annual, money); // 增加年度充值数据
} else if (timeType == TimeType.Annual) {
dataAPI.addValueData(TimeType.Annual, money); // 增加年度充值数据
if (timeType == TimeType.DAILY) {
dataAPI.addValueData(TimeType.DAILY, money); // 增加每日充值数据
dataAPI.addValueData(TimeType.MONTHLY, money); // 增加每月充值数据
dataAPI.addValueData(TimeType.ANNUAL, money); // 增加年度充值数据
} else if (timeType == TimeType.MONTHLY) {
dataAPI.addValueData(TimeType.MONTHLY, money); // 增加每月充值数据
dataAPI.addValueData(TimeType.ANNUAL, money); // 增加年度充值数据
} else if (timeType == TimeType.ANNUAL) {
dataAPI.addValueData(TimeType.ANNUAL, money); // 增加年度充值数据
}
}
@ -90,15 +90,15 @@ public abstract class RechargeAPI {
RechargeManage manage = Main.rechargeManage; // 获取充值管理实例
PlayerData dataAPI = manage.getPlayerData(name); // 获取玩家的充值数据实例
// 根据时间类型设置玩家的累积充值数据
if (timeType == TimeType.Daily) {
dataAPI.setValueData(TimeType.Daily, money); // 设置每日累积充值数据
dataAPI.setValueData(TimeType.Monthly, money); // 设置每月累积充值数据
dataAPI.setValueData(TimeType.Annual, money); // 设置年度累积充值数据
} else if (timeType == TimeType.Monthly) {
dataAPI.setValueData(TimeType.Monthly, money); // 设置每月累积充值数据
dataAPI.setValueData(TimeType.Annual, money); // 设置年度累积充值数据
} else if (timeType == TimeType.Annual) {
dataAPI.setValueData(TimeType.Annual, money); // 设置年度累积充值数据
if (timeType == TimeType.DAILY) {
dataAPI.setValueData(TimeType.DAILY, money); // 设置每日累积充值数据
dataAPI.setValueData(TimeType.MONTHLY, money); // 设置每月累积充值数据
dataAPI.setValueData(TimeType.ANNUAL, money); // 设置年度累积充值数据
} else if (timeType == TimeType.MONTHLY) {
dataAPI.setValueData(TimeType.MONTHLY, money); // 设置每月累积充值数据
dataAPI.setValueData(TimeType.ANNUAL, money); // 设置年度累积充值数据
} else if (timeType == TimeType.ANNUAL) {
dataAPI.setValueData(TimeType.ANNUAL, money); // 设置年度累积充值数据
}
}
@ -106,44 +106,44 @@ public abstract class RechargeAPI {
RechargeManage manage = Main.rechargeManage; // 获取充值管理实例
PlayerData dataAPI = manage.getPlayerData(name); // 获取玩家的充值数据实例
// 根据时间类型减少玩家的累积充值数据
if (timeType == TimeType.Daily) {
int currentDaily = dataAPI.getValueData(TimeType.Daily);
if (timeType == TimeType.DAILY) {
int currentDaily = dataAPI.getValueData(TimeType.DAILY);
if (currentDaily >= money) {
dataAPI.setValueData(TimeType.Daily, currentDaily - money); // 减少每日累积充值数据
dataAPI.setValueData(TimeType.DAILY, currentDaily - money); // 减少每日累积充值数据
} else {
dataAPI.setValueData(TimeType.Daily, 0); // 如果减少金额大于当前累积值设为0
dataAPI.setValueData(TimeType.DAILY, 0); // 如果减少金额大于当前累积值设为0
}
int currentMonthly = dataAPI.getValueData(TimeType.Monthly);
int currentMonthly = dataAPI.getValueData(TimeType.MONTHLY);
if (currentMonthly >= money) {
dataAPI.setValueData(TimeType.Monthly, currentMonthly - money); // 减少每月累积充值数据
dataAPI.setValueData(TimeType.MONTHLY, currentMonthly - money); // 减少每月累积充值数据
} else {
dataAPI.setValueData(TimeType.Monthly, 0); // 如果减少金额大于当前累积值设为0
dataAPI.setValueData(TimeType.MONTHLY, 0); // 如果减少金额大于当前累积值设为0
}
int currentAnnual = dataAPI.getValueData(TimeType.Annual);
int currentAnnual = dataAPI.getValueData(TimeType.ANNUAL);
if (currentAnnual >= money) {
dataAPI.setValueData(TimeType.Annual, currentAnnual - money); // 减少年度累积充值数据
dataAPI.setValueData(TimeType.ANNUAL, currentAnnual - money); // 减少年度累积充值数据
} else {
dataAPI.setValueData(TimeType.Annual, 0); // 如果减少金额大于当前累积值设为0
dataAPI.setValueData(TimeType.ANNUAL, 0); // 如果减少金额大于当前累积值设为0
}
} else if (timeType == TimeType.Monthly) {
int currentMonthly = dataAPI.getValueData(TimeType.Monthly);
} else if (timeType == TimeType.MONTHLY) {
int currentMonthly = dataAPI.getValueData(TimeType.MONTHLY);
if (currentMonthly >= money) {
dataAPI.setValueData(TimeType.Monthly, currentMonthly - money); // 减少每月累积充值数据
dataAPI.setValueData(TimeType.MONTHLY, currentMonthly - money); // 减少每月累积充值数据
} else {
dataAPI.setValueData(TimeType.Monthly, 0); // 如果减少金额大于当前累积值设为0
dataAPI.setValueData(TimeType.MONTHLY, 0); // 如果减少金额大于当前累积值设为0
}
int currentAnnual = dataAPI.getValueData(TimeType.Annual);
int currentAnnual = dataAPI.getValueData(TimeType.ANNUAL);
if (currentAnnual >= money) {
dataAPI.setValueData(TimeType.Annual, currentAnnual - money); // 减少年度累积充值数据
dataAPI.setValueData(TimeType.ANNUAL, currentAnnual - money); // 减少年度累积充值数据
} else {
dataAPI.setValueData(TimeType.Annual, 0); // 如果减少金额大于当前累积值设为0
dataAPI.setValueData(TimeType.ANNUAL, 0); // 如果减少金额大于当前累积值设为0
}
} else if (timeType == TimeType.Annual) {
int currentAnnual = dataAPI.getValueData(TimeType.Annual);
} else if (timeType == TimeType.ANNUAL) {
int currentAnnual = dataAPI.getValueData(TimeType.ANNUAL);
if (currentAnnual >= money) {
dataAPI.setValueData(TimeType.Annual, currentAnnual - money); // 减少年度累积充值数据
dataAPI.setValueData(TimeType.ANNUAL, currentAnnual - money); // 减少年度累积充值数据
} else {
dataAPI.setValueData(TimeType.Annual, 0); // 如果减少金额大于当前累积值设为0
dataAPI.setValueData(TimeType.ANNUAL, 0); // 如果减少金额大于当前累积值设为0
}
}
}

View File

@ -20,7 +20,9 @@ import java.util.List;
public class MainCmd implements CommandExecutor , TabCompleter {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if(!sender.isOp()){return true;}
if (!sender.isOp()) {
return true;
}
if(args.length == 0){
sender.sendMessage("§r");
sender.sendMessage("§e------- ======= §6充值数据统计 §e======= -------");
@ -51,8 +53,8 @@ public class MainCmd implements CommandExecutor , TabCompleter {
String playName = args[1];
sender.sendMessage("§f[§c消息§f] §a玩家充值信息查询:");
sender.sendMessage("§a玩家名称§f: §6"+playName);
sender.sendMessage("§a本月充值§f: §e"+RechargeAPI.getRechargeData(playName,TimeType.Monthly)+"");
sender.sendMessage("§a累计充值§f: §e"+RechargeAPI.getRechargeData(playName,TimeType.Annual)+"");
sender.sendMessage("§a本月充值§f: §e"+RechargeAPI.getRechargeData(playName,TimeType.MONTHLY)+"");
sender.sendMessage("§a累计充值§f: §e"+RechargeAPI.getRechargeData(playName,TimeType.ANNUAL)+"");
sender.sendMessage("§a累计消费§f: §b0软");
sender.sendMessage("§a最后一次充值§f: §d"+RechargeAPI.getRechargePlayer(playName).getLastOperationShow());
return true;
@ -74,28 +76,28 @@ public class MainCmd implements CommandExecutor , TabCompleter {
if (giveType.equalsIgnoreCase("cz")) {
// 执行每日每月和年度充值操作默认为每日
RechargeAPI.addRechargeData(playerName, amount);
int setVal = RechargeAPI.getRechargeData(playerName,TimeType.Daily);
int setVal = RechargeAPI.getRechargeData(playerName,TimeType.DAILY);
sender.sendMessage("§7[§6累积充值§7] §f已增加 §6" + playerName + " §f每日 §b" + amount + "累计 §f已累积充值: §e" + setVal);
RechargeEvent rechargeEvent = new RechargeEvent(playerName,amount);
Bukkit.getPluginManager().callEvent(rechargeEvent);
} else if (giveType.equalsIgnoreCase("give")) {
// 执行每日每月和年度充值操作默认为每日
RechargeAPI.addRechargeData(playerName, amount);
int setVal = RechargeAPI.getRechargeData(playerName,TimeType.Daily);
int setVal = RechargeAPI.getRechargeData(playerName,TimeType.DAILY);
sender.sendMessage("§7[§6累积充值§7] §f已增加 §6" + playerName + " §f每日 §b" + amount + "累计 §f已累积充值: §e" + setVal);
} else if (giveType.equalsIgnoreCase("givemonth")) {
// 执行每月充值操作
RechargeAPI.addRechargeData(playerName, amount, TimeType.Monthly);
int setVal = RechargeAPI.getRechargeData(playerName,TimeType.Monthly);
RechargeAPI.addRechargeData(playerName, amount, TimeType.MONTHLY);
int setVal = RechargeAPI.getRechargeData(playerName,TimeType.MONTHLY);
sender.sendMessage("§7[§6累积充值§7] §f已增加 §6" + playerName + " §f每月 §b" + amount + "累计 §f已累积充值: §e" + setVal);
} else if (giveType.equalsIgnoreCase("giveannual")) {
// 执行年度充值操作
RechargeAPI.addRechargeData(playerName, amount, TimeType.Annual);
int setVal = RechargeAPI.getRechargeData(playerName,TimeType.Annual);
RechargeAPI.addRechargeData(playerName, amount, TimeType.ANNUAL);
int setVal = RechargeAPI.getRechargeData(playerName,TimeType.ANNUAL);
sender.sendMessage("§7[§6累积充值§7] §f已增加 §6" + playerName + " §f永久 §b" + amount + "累计 §f已累积充值: §e" + setVal);
} else if (giveType.equalsIgnoreCase("take")) {
RechargeAPI.takeRechargeData(playerName,amount);
int setVal = RechargeAPI.getRechargeData(playerName,TimeType.Annual);
int setVal = RechargeAPI.getRechargeData(playerName,TimeType.ANNUAL);
sender.sendMessage("§7[§6累积充值§7] §f已扣除 §6" + playerName + " §f永久 §c-" + amount + "累计 §f已累积充值: §e" + setVal);
}
}

View File

@ -24,20 +24,20 @@ public class PlayerData {
int value = section.getInt(dataKey); // 获取键对应的整数值
// 根据键名将值存储到不同的时间类型中
if (dataKey.equalsIgnoreCase("daydata")) {
valueMap.put(TimeType.Daily, value); // 每日数据
valueMap.put(TimeType.DAILY, value); // 每日数据
} else if (dataKey.equalsIgnoreCase("monthdata")) {
valueMap.put(TimeType.Monthly, value); // 每月数据
valueMap.put(TimeType.MONTHLY, value); // 每月数据
} else if(dataKey.equalsIgnoreCase("annualData")){
valueMap.put(TimeType.Annual, value); // 年度数据
valueMap.put(TimeType.ANNUAL, value); // 年度数据
} else if(dataKey.equalsIgnoreCase("lastOperation")){
lastOperation = section.getLong(dataKey);
}
}
}else{
// 配置节为空时存入默认数据
valueMap.put(TimeType.Daily, 0);
valueMap.put(TimeType.Monthly, 0);
valueMap.put(TimeType.Annual, 0);
valueMap.put(TimeType.DAILY, 0);
valueMap.put(TimeType.MONTHLY, 0);
valueMap.put(TimeType.ANNUAL, 0);
}
}
@ -81,9 +81,9 @@ public class PlayerData {
// 根据时间类型返回对应的数据键名
public String getTimeToString(TimeType timeType) {
if (timeType == TimeType.Daily) {
if (timeType == TimeType.DAILY) {
return "daydata"; // 如果时间类型是每日则返回对应的数据键名
} else if (timeType == TimeType.Monthly) {
} else if (timeType == TimeType.MONTHLY) {
return "monthdata"; // 如果时间类型是每月则返回对应的数据键名
}
return "annualData"; // 默认情况下返回年度数据键名

View File

@ -21,8 +21,8 @@ public class ConsumeManage {
private String dataKey = "ConsumeData";
private HashMap<String, PlayerData> dataHashMap = new HashMap<>();
public ConsumeManage(){
file = new File("plugins/AuRechargeData", "consume.yml");
public ConsumeManage() {
file = new File(Main.plugin.getDataFolder(), "consume.yml");
// 如果文件不存在则创建新文件
if (!file.exists()) {
try {
@ -36,10 +36,10 @@ public class ConsumeManage {
// 检查配置文件中是否包含 "ConsumeData" 节点
if (yml.getConfigurationSection(dataKey) != null) {
boolean updated = false; // 标记是否进行了数据更新
if(UpdataTime.isDayDataUpdata()){
if (UpdataTime.isDayDataUpdata()) {
// 遍历 "ConsumeData" 节点下的所有键用户名
for (String name : yml.getConfigurationSection(dataKey).getKeys(false)) {
yml.set(dataKey+"."+name+".daydata",null);// 将每位玩家的每日充值数据置为空
yml.set(dataKey+"."+name+".daydata", null);// 将每位玩家的每日充值数据置为空
}
// 保存配置文件
try {
@ -49,7 +49,7 @@ public class ConsumeManage {
}
updated = true; // 标记数据已更新
}
if(UpdataTime.isMonthDataUpdata()){
if (UpdataTime.isMonthDataUpdata()) {
// 遍历 "ConsumeData" 节点下的所有键用户名
for (String name : yml.getConfigurationSection(dataKey).getKeys(false)) {
yml.set(dataKey+"."+name+".monthdata",null);// 将每位玩家的每日充值数据置为空
@ -91,19 +91,19 @@ public class ConsumeManage {
Bukkit.getConsoleSender().sendMessage("§6[充值数据] §f已有消费记录的玩家: §a" + dataHashMap.size() + "");
}
public void SaveData(){
yml.set(dataKey,null);
public void saveData() {
yml.set(dataKey, null);
for (String name : dataHashMap.keySet()){
PlayerData playerData = dataHashMap.get(name);
for (TimeType timeType : playerData.getValueMap().keySet()){
int value = playerData.getValueData(timeType);
String timeKey = playerData.getTimeToString(timeType);
if(value >= 1) {
if (value >= 1) {
yml.set(dataKey + "." + name + "." + timeKey, value);
}
}
long lastOperation = playerData.getLastOperation();
if(lastOperation >= 1000){
if (lastOperation >= 1000) {
yml.set(dataKey+"."+name+".lastOperation",lastOperation);
}
}

View File

@ -94,8 +94,8 @@ public class RechargeManage {
Bukkit.getConsoleSender().sendMessage("§6[充值数据] §f已有充值记录的玩家: §a" + dataHashMap.size() + "");
}
public void SaveData(){
yml.set(dataKey,null);
public void saveData() {
yml.set(dataKey, null);
for (String name : dataHashMap.keySet()){
PlayerData playerData = dataHashMap.get(name);
for (TimeType timeType : playerData.getValueMap().keySet()){
@ -107,7 +107,7 @@ public class RechargeManage {
Bukkit.getConsoleSender().sendMessage("[调试] "+name+" value: "+timeKey+" = "+value);
}
long lastOperation = playerData.getLastOperation();
if(lastOperation >= 1000){
if (lastOperation >= 1000) {
yml.set(dataKey+"."+name+".lastOperation",lastOperation);
}
}
@ -135,7 +135,7 @@ public class RechargeManage {
for (PlayerData playerData : dataHashMap.values()) {
// 获取玩家名称和每月充值金额
String playerName = playerData.getName();
int monthlyRecharge = playerData.getValueData(TimeType.Monthly);
int monthlyRecharge = playerData.getValueData(TimeType.MONTHLY);
// 创建 PlayerMonthlyRecharge 对象并添加到列表中
hashMap.put(playerName,monthlyRecharge);
}
@ -150,7 +150,7 @@ public class RechargeManage {
));
}
public String getMonthlyRankingName(int rank){
public String getMonthlyRankingName(int rank) {
List<String> playerNames = new ArrayList<>(monthRechargeTop.keySet());
if (rank <= playerNames.size()) {
return playerNames.get(rank - 1);
@ -158,7 +158,7 @@ public class RechargeManage {
return "暂无";
}
}
public int getMonthlyRankingValue(int rank){
public int getMonthlyRankingValue(int rank) {
List<String> playerNames = new ArrayList<>(monthRechargeTop.keySet());
if (rank <= playerNames.size()) {
String playerName = playerNames.get(rank - 1);
@ -168,7 +168,7 @@ public class RechargeManage {
}
}
public String getRankingPlayer(int rank,String type){
public String getRankingPlayer(int rank,String type) {
if(type.equalsIgnoreCase("name")){
return getMonthlyRankingName(rank);
}

View File

@ -1,5 +1,7 @@
package com.yaohun.aurechargedata.util;
public enum TimeType {
Annual,Monthly,Daily
ANNUAL,
MONTHLY,
DAILY
}

View File

@ -9,7 +9,7 @@ import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Date;
public abstract class UpdataTime {
public class UpdataTime {
/*
* 获取 每日数据刷新的记录时间
@ -22,12 +22,12 @@ public abstract class UpdataTime {
LocalDate lastUpdateDate = new Date(dayRecordsTime).toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
// 获取当前日期
LocalDate currentDate = LocalDate.now();
if(currentDate.isAfter(lastUpdateDate)) {
if (currentDate.isAfter(lastUpdateDate)) {
// 如果是次日更新配置文件中的刷新时间为当前时间
yml.set("DayTime", System.currentTimeMillis());
Main.plugin.saveConfig();
return true;
}else{
} else {
return false;
}
}