升级工具库版本
This commit is contained in:
parent
c1df7a44c2
commit
118a4e72d0
@ -26,6 +26,7 @@
|
|||||||
- 本插件使用 **TUI** 作为简易的交互方式,非 PlayerTitle 的箱子UI
|
- 本插件使用 **TUI** 作为简易的交互方式,非 PlayerTitle 的箱子UI
|
||||||
- 支持设置称号**限量销售、限时销售**
|
- 支持设置称号**限量销售、限时销售**
|
||||||
- 支持玩家使用称号币自定义称号
|
- 支持玩家使用称号币自定义称号
|
||||||
|
- 支持外部经济系统(需要 Vault 前置支持)
|
||||||
|
|
||||||
## 支持版本
|
## 支持版本
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package cn.lunadeer.miniplayertitle;
|
package cn.lunadeer.miniplayertitle;
|
||||||
|
|
||||||
|
import cn.lunadeer.minecraftpluginutils.XLogger;
|
||||||
import net.kyori.adventure.text.format.Style;
|
import net.kyori.adventure.text.format.Style;
|
||||||
import net.kyori.adventure.text.format.TextColor;
|
import net.kyori.adventure.text.format.TextColor;
|
||||||
|
|
||||||
@ -27,7 +28,7 @@ public class Color {
|
|||||||
this.g = 0;
|
this.g = 0;
|
||||||
this.b = 0;
|
this.b = 0;
|
||||||
this.hex = "#000000";
|
this.hex = "#000000";
|
||||||
MiniPlayerTitle.logger.err("Invalid color: " + r + ", " + g + ", " + b);
|
XLogger.err("Invalid color: " + r + ", " + g + ", " + b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,7 +43,7 @@ public class Color {
|
|||||||
this.g = 0;
|
this.g = 0;
|
||||||
this.b = 0;
|
this.b = 0;
|
||||||
this.hex = "#000000";
|
this.hex = "#000000";
|
||||||
MiniPlayerTitle.logger.err("Invalid color: " + hex);
|
XLogger.err("Invalid color: " + hex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package cn.lunadeer.miniplayertitle;
|
package cn.lunadeer.miniplayertitle;
|
||||||
|
|
||||||
|
import cn.lunadeer.minecraftpluginutils.Notification;
|
||||||
import cn.lunadeer.miniplayertitle.dtos.PlayerInfoDTO;
|
import cn.lunadeer.miniplayertitle.dtos.PlayerInfoDTO;
|
||||||
import cn.lunadeer.miniplayertitle.dtos.PlayerTitleDTO;
|
import cn.lunadeer.miniplayertitle.dtos.PlayerTitleDTO;
|
||||||
import io.papermc.paper.event.player.AsyncChatEvent;
|
import io.papermc.paper.event.player.AsyncChatEvent;
|
||||||
@ -18,7 +19,7 @@ public class Events implements Listener {
|
|||||||
Player bukkitPlayer = event.getPlayer();
|
Player bukkitPlayer = event.getPlayer();
|
||||||
PlayerInfoDTO player = PlayerInfoDTO.get(bukkitPlayer);
|
PlayerInfoDTO player = PlayerInfoDTO.get(bukkitPlayer);
|
||||||
if (player == null) {
|
if (player == null) {
|
||||||
MiniPlayerTitle.notification.error(bukkitPlayer, "获取玩家信息时出现错误,请联系管理员");
|
Notification.error(bukkitPlayer, "获取玩家信息时出现错误,请联系管理员");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (player.getUsingTitle().getId() == -1) {
|
if (player.getUsingTitle().getId() == -1) {
|
||||||
@ -27,7 +28,7 @@ public class Events implements Listener {
|
|||||||
}
|
}
|
||||||
PlayerTitleDTO title = PlayerTitleDTO.get(bukkitPlayer.getUniqueId(), player.getUsingTitle().getId());
|
PlayerTitleDTO title = PlayerTitleDTO.get(bukkitPlayer.getUniqueId(), player.getUsingTitle().getId());
|
||||||
if (title == null || title.isExpired()) {
|
if (title == null || title.isExpired()) {
|
||||||
MiniPlayerTitle.notification.warn(bukkitPlayer, "你当前使用的称号 %s 已过期", player.getUsingTitle().getTitlePlainText());
|
Notification.warn(bukkitPlayer, "你当前使用的称号 %s 已过期", player.getUsingTitle().getTitlePlainText());
|
||||||
player.setUsingTitle(null);
|
player.setUsingTitle(null);
|
||||||
updateName(bukkitPlayer, null);
|
updateName(bukkitPlayer, null);
|
||||||
} else {
|
} else {
|
||||||
|
@ -15,10 +15,10 @@ public final class MiniPlayerTitle extends JavaPlugin {
|
|||||||
// Plugin startup logic
|
// Plugin startup logic
|
||||||
instance = this;
|
instance = this;
|
||||||
new Scheduler(this);
|
new Scheduler(this);
|
||||||
notification = new Notification(this);
|
new Notification(this);
|
||||||
logger = new XLogger(instance);
|
new XLogger(instance);
|
||||||
config = new ConfigManager(instance);
|
new ConfigManager(instance);
|
||||||
logger.setDebug(config.isDebug());
|
XLogger.setDebug(config.isDebug());
|
||||||
database = new DatabaseManager(this,
|
database = new DatabaseManager(this,
|
||||||
DatabaseManager.TYPE.valueOf(config.getDbType().toUpperCase()),
|
DatabaseManager.TYPE.valueOf(config.getDbType().toUpperCase()),
|
||||||
config.getDbHost(),
|
config.getDbHost(),
|
||||||
@ -29,7 +29,7 @@ public final class MiniPlayerTitle extends JavaPlugin {
|
|||||||
DatabaseTables.migrate();
|
DatabaseTables.migrate();
|
||||||
|
|
||||||
if (config.isExternalEco()) {
|
if (config.isExternalEco()) {
|
||||||
logger.info("已启用外部经济插件");
|
XLogger.info("已启用外部经济插件");
|
||||||
new VaultConnect(this);
|
new VaultConnect(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,17 +45,17 @@ public final class MiniPlayerTitle extends JavaPlugin {
|
|||||||
"MiniPlayerTitle");
|
"MiniPlayerTitle");
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.info("称号插件已加载");
|
XLogger.info("称号插件已加载");
|
||||||
logger.info("版本: " + getPluginMeta().getVersion());
|
XLogger.info("版本: " + getPluginMeta().getVersion());
|
||||||
// http://patorjk.com/software/taag/#p=display&f=Big&t=MiniPlayerTitle
|
// http://patorjk.com/software/taag/#p=display&f=Big&t=MiniPlayerTitle
|
||||||
logger.info(" __ __ _ _ _____ _ _______ _ _ _");
|
XLogger.info(" __ __ _ _ _____ _ _______ _ _ _");
|
||||||
logger.info(" | \\/ (_) (_) __ \\| | |__ __(_) | | |");
|
XLogger.info(" | \\/ (_) (_) __ \\| | |__ __(_) | | |");
|
||||||
logger.info(" | \\ / |_ _ __ _| |__) | | __ _ _ _ ___ _ __| | _| |_| | ___");
|
XLogger.info(" | \\ / |_ _ __ _| |__) | | __ _ _ _ ___ _ __| | _| |_| | ___");
|
||||||
logger.info(" | |\\/| | | '_ \\| | ___/| |/ _` | | | |/ _ \\ '__| | | | __| |/ _ \\");
|
XLogger.info(" | |\\/| | | '_ \\| | ___/| |/ _` | | | |/ _ \\ '__| | | | __| |/ _ \\");
|
||||||
logger.info(" | | | | | | | | | | | | (_| | |_| | __/ | | | | | |_| | __/");
|
XLogger.info(" | | | | | | | | | | | | (_| | |_| | __/ | | | | | |_| | __/");
|
||||||
logger.info(" |_| |_|_|_| |_|_|_| |_|\\__,_|\\__, |\\___|_| |_| |_|\\__|_|\\___|");
|
XLogger.info(" |_| |_|_|_| |_|_|_| |_|\\__,_|\\__, |\\___|_| |_| |_|\\__|_|\\___|");
|
||||||
logger.info(" __/ |");
|
XLogger.info(" __/ |");
|
||||||
logger.info(" |___/");
|
XLogger.info(" |___/");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -66,7 +66,5 @@ public final class MiniPlayerTitle extends JavaPlugin {
|
|||||||
public static MiniPlayerTitle instance;
|
public static MiniPlayerTitle instance;
|
||||||
public static ConfigManager config;
|
public static ConfigManager config;
|
||||||
public static DatabaseManager database;
|
public static DatabaseManager database;
|
||||||
public static XLogger logger;
|
|
||||||
public static Notification notification;
|
|
||||||
private GiteaReleaseCheck giteaReleaseCheck;
|
private GiteaReleaseCheck giteaReleaseCheck;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package cn.lunadeer.miniplayertitle.commands;
|
package cn.lunadeer.miniplayertitle.commands;
|
||||||
|
|
||||||
import cn.lunadeer.miniplayertitle.MiniPlayerTitle;
|
import cn.lunadeer.minecraftpluginutils.Notification;
|
||||||
import cn.lunadeer.miniplayertitle.dtos.TitleDTO;
|
import cn.lunadeer.miniplayertitle.dtos.TitleDTO;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -13,7 +13,7 @@ public class Apis {
|
|||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
if (!player.isOp()) {
|
if (!player.isOp()) {
|
||||||
MiniPlayerTitle.notification.warn(player, "你没有权限使用此命令");
|
Notification.warn(player, "你没有权限使用此命令");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package cn.lunadeer.miniplayertitle.commands;
|
package cn.lunadeer.miniplayertitle.commands;
|
||||||
|
|
||||||
import cn.lunadeer.miniplayertitle.MiniPlayerTitle;
|
import cn.lunadeer.minecraftpluginutils.Notification;
|
||||||
import cn.lunadeer.miniplayertitle.dtos.PlayerInfoDTO;
|
import cn.lunadeer.miniplayertitle.dtos.PlayerInfoDTO;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
@ -20,17 +20,17 @@ public class PlayerManage {
|
|||||||
try {
|
try {
|
||||||
PlayerInfoDTO playerInfo = PlayerInfoDTO.get(args[1]);
|
PlayerInfoDTO playerInfo = PlayerInfoDTO.get(args[1]);
|
||||||
if (playerInfo == null) {
|
if (playerInfo == null) {
|
||||||
MiniPlayerTitle.notification.error(sender, "玩家不存在");
|
Notification.error(sender, "玩家不存在");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (playerInfo.addCoin(Integer.parseInt(args[2]))) {
|
if (playerInfo.addCoin(Integer.parseInt(args[2]))) {
|
||||||
MiniPlayerTitle.notification.info(sender, "成功给玩家 %s 添加 %s 称号币", playerInfo.getLastUseName(), args[2]);
|
Notification.info(sender, "成功给玩家 %s 添加 %s 称号币", playerInfo.getLastUseName(), args[2]);
|
||||||
MiniPlayerTitle.notification.info(sender, "玩家 %s 当前余额 %f 称号币", playerInfo.getLastUseName(), playerInfo.getCoin());
|
Notification.info(sender, "玩家 %s 当前余额 %f 称号币", playerInfo.getLastUseName(), playerInfo.getCoin());
|
||||||
} else {
|
} else {
|
||||||
MiniPlayerTitle.notification.error(sender, "给玩家添加称号币失败,详细错误请查看控制台日志");
|
Notification.error(sender, "给玩家添加称号币失败,详细错误请查看控制台日志");
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
MiniPlayerTitle.notification.error(sender, "给玩家添加称号币时出错:%s", e.getMessage());
|
Notification.error(sender, "给玩家添加称号币时出错:%s", e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,17 +46,17 @@ public class PlayerManage {
|
|||||||
try {
|
try {
|
||||||
PlayerInfoDTO playerInfo = PlayerInfoDTO.get(args[1]);
|
PlayerInfoDTO playerInfo = PlayerInfoDTO.get(args[1]);
|
||||||
if (playerInfo == null) {
|
if (playerInfo == null) {
|
||||||
MiniPlayerTitle.notification.error(sender, "玩家不存在");
|
Notification.error(sender, "玩家不存在");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (playerInfo.setCoin(Integer.parseInt(args[2]))) {
|
if (playerInfo.setCoin(Integer.parseInt(args[2]))) {
|
||||||
MiniPlayerTitle.notification.info(sender, "成功给玩家 %s 设置 %s 称号币", playerInfo.getLastUseName(), args[2]);
|
Notification.info(sender, "成功给玩家 %s 设置 %s 称号币", playerInfo.getLastUseName(), args[2]);
|
||||||
MiniPlayerTitle.notification.info(sender, "玩家 %s 当前余额 %f 称号币", playerInfo.getLastUseName(), playerInfo.getCoin());
|
Notification.info(sender, "玩家 %s 当前余额 %f 称号币", playerInfo.getLastUseName(), playerInfo.getCoin());
|
||||||
} else {
|
} else {
|
||||||
MiniPlayerTitle.notification.error(sender, "给玩家设置称号币失败,详细错误请查看控制台日志");
|
Notification.error(sender, "给玩家设置称号币失败,详细错误请查看控制台日志");
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
MiniPlayerTitle.notification.error(sender, "给玩家设置称号币时出错:%s", e.getMessage());
|
Notification.error(sender, "给玩家设置称号币时出错:%s", e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package cn.lunadeer.miniplayertitle.commands;
|
package cn.lunadeer.miniplayertitle.commands;
|
||||||
|
|
||||||
|
import cn.lunadeer.minecraftpluginutils.Notification;
|
||||||
import cn.lunadeer.miniplayertitle.MiniPlayerTitle;
|
import cn.lunadeer.miniplayertitle.MiniPlayerTitle;
|
||||||
import cn.lunadeer.miniplayertitle.dtos.PlayerInfoDTO;
|
import cn.lunadeer.miniplayertitle.dtos.PlayerInfoDTO;
|
||||||
import cn.lunadeer.miniplayertitle.dtos.PlayerTitleDTO;
|
import cn.lunadeer.miniplayertitle.dtos.PlayerTitleDTO;
|
||||||
@ -10,8 +11,6 @@ import net.kyori.adventure.text.Component;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
import static cn.lunadeer.miniplayertitle.commands.Apis.notOpOrConsole;
|
import static cn.lunadeer.miniplayertitle.commands.Apis.notOpOrConsole;
|
||||||
import static cn.lunadeer.miniplayertitle.commands.Apis.updateName;
|
import static cn.lunadeer.miniplayertitle.commands.Apis.updateName;
|
||||||
|
|
||||||
@ -26,15 +25,15 @@ public class TitleManage {
|
|||||||
public static void createTitle(CommandSender sender, String[] args) {
|
public static void createTitle(CommandSender sender, String[] args) {
|
||||||
if (notOpOrConsole(sender)) return;
|
if (notOpOrConsole(sender)) return;
|
||||||
if (args.length < 2) {
|
if (args.length < 2) {
|
||||||
MiniPlayerTitle.notification.warn(sender, "用法: /mplt create_title <称号名称> [称号描述]");
|
Notification.warn(sender, "用法: /mplt create_title <称号名称> [称号描述]");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
TitleDTO title = TitleDTO.create(args[1], args.length == 3 ? args[2] : "这是一个管理员创建的称号");
|
TitleDTO title = TitleDTO.create(args[1], args.length == 3 ? args[2] : "这是一个管理员创建的称号");
|
||||||
if (title != null) {
|
if (title != null) {
|
||||||
MiniPlayerTitle.notification.info(sender, Component.text("成功创建称号: [" + title.getId() + "]").append(title.getTitleColored()));
|
Notification.info(sender, Component.text("成功创建称号: [" + title.getId() + "]").append(title.getTitleColored()));
|
||||||
AllTitles.show(sender, new String[]{"all_titles"});
|
AllTitles.show(sender, new String[]{"all_titles"});
|
||||||
} else {
|
} else {
|
||||||
MiniPlayerTitle.notification.error(sender, "创建称号失败,具体请查看控制台日志");
|
Notification.error(sender, "创建称号失败,具体请查看控制台日志");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,26 +48,26 @@ public class TitleManage {
|
|||||||
try {
|
try {
|
||||||
if (notOpOrConsole(sender)) return;
|
if (notOpOrConsole(sender)) return;
|
||||||
if (args.length < 2) {
|
if (args.length < 2) {
|
||||||
MiniPlayerTitle.notification.warn(sender, "用法: /mplt delete_title <称号ID>");
|
Notification.warn(sender, "用法: /mplt delete_title <称号ID>");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
TitleDTO title = TitleDTO.get(Integer.parseInt(args[1]));
|
TitleDTO title = TitleDTO.get(Integer.parseInt(args[1]));
|
||||||
if (title == null) {
|
if (title == null) {
|
||||||
MiniPlayerTitle.notification.error(sender, "称号不存在");
|
Notification.error(sender, "称号不存在");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
boolean success = title.delete();
|
boolean success = title.delete();
|
||||||
if (!success) {
|
if (!success) {
|
||||||
MiniPlayerTitle.notification.error(sender, "删除称号失败,具体请查看控制台日志");
|
Notification.error(sender, "删除称号失败,具体请查看控制台日志");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MiniPlayerTitle.notification.info(sender, "已删除称号");
|
Notification.info(sender, "已删除称号");
|
||||||
if (args.length == 3) {
|
if (args.length == 3) {
|
||||||
int page = Integer.parseInt(args[2]);
|
int page = Integer.parseInt(args[2]);
|
||||||
AllTitles.show(sender, new String[]{"all_titles", String.valueOf(page)});
|
AllTitles.show(sender, new String[]{"all_titles", String.valueOf(page)});
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
MiniPlayerTitle.notification.error(sender, e.getMessage());
|
Notification.error(sender, e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,22 +82,22 @@ public class TitleManage {
|
|||||||
try {
|
try {
|
||||||
if (notOpOrConsole(sender)) return;
|
if (notOpOrConsole(sender)) return;
|
||||||
if (args.length != 3) {
|
if (args.length != 3) {
|
||||||
MiniPlayerTitle.notification.warn(sender, "用法: /mplt set_title <称号ID> <称号名称>");
|
Notification.warn(sender, "用法: /mplt set_title <称号ID> <称号名称>");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
TitleDTO title = TitleDTO.get(Integer.parseInt(args[1]));
|
TitleDTO title = TitleDTO.get(Integer.parseInt(args[1]));
|
||||||
if (title == null) {
|
if (title == null) {
|
||||||
MiniPlayerTitle.notification.error(sender, "称号不存在");
|
Notification.error(sender, "称号不存在");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
boolean success = title.updateTitle(args[2]);
|
boolean success = title.updateTitle(args[2]);
|
||||||
if (success) {
|
if (success) {
|
||||||
MiniPlayerTitle.notification.info(sender, "已更新称号名称");
|
Notification.info(sender, "已更新称号名称");
|
||||||
} else {
|
} else {
|
||||||
MiniPlayerTitle.notification.error(sender, "更新称号名称失败,具体请查看控制台日志");
|
Notification.error(sender, "更新称号名称失败,具体请查看控制台日志");
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
MiniPlayerTitle.notification.error(sender, e.getMessage());
|
Notification.error(sender, e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,22 +112,22 @@ public class TitleManage {
|
|||||||
try {
|
try {
|
||||||
if (notOpOrConsole(sender)) return;
|
if (notOpOrConsole(sender)) return;
|
||||||
if (args.length != 3) {
|
if (args.length != 3) {
|
||||||
MiniPlayerTitle.notification.warn(sender, "用法: /mplt set_desc <称号ID> <称号描述>");
|
Notification.warn(sender, "用法: /mplt set_desc <称号ID> <称号描述>");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
TitleDTO title = TitleDTO.get(Integer.parseInt(args[1]));
|
TitleDTO title = TitleDTO.get(Integer.parseInt(args[1]));
|
||||||
if (title == null) {
|
if (title == null) {
|
||||||
MiniPlayerTitle.notification.error(sender, "称号不存在");
|
Notification.error(sender, "称号不存在");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
boolean success = title.updateDescription(args[2]);
|
boolean success = title.updateDescription(args[2]);
|
||||||
if (success) {
|
if (success) {
|
||||||
MiniPlayerTitle.notification.info(sender, "已更新称号描述");
|
Notification.info(sender, "已更新称号描述");
|
||||||
} else {
|
} else {
|
||||||
MiniPlayerTitle.notification.error(sender, "更新称号描述失败,具体请查看控制台日志");
|
Notification.error(sender, "更新称号描述失败,具体请查看控制台日志");
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
MiniPlayerTitle.notification.error(sender, e.getMessage());
|
Notification.error(sender, e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,30 +140,30 @@ public class TitleManage {
|
|||||||
*/
|
*/
|
||||||
public static void useTitle(CommandSender sender, String[] args) {
|
public static void useTitle(CommandSender sender, String[] args) {
|
||||||
if (!(sender instanceof Player)) {
|
if (!(sender instanceof Player)) {
|
||||||
MiniPlayerTitle.notification.error(sender, "该命令只能由玩家执行");
|
Notification.error(sender, "该命令只能由玩家执行");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (args.length < 2) {
|
if (args.length < 2) {
|
||||||
MiniPlayerTitle.notification.warn(sender, "用法: /mplt use_title <背包ID> [页码]");
|
Notification.warn(sender, "用法: /mplt use_title <背包ID> [页码]");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
PlayerTitleDTO title = PlayerTitleDTO.get(Integer.parseInt(args[1]));
|
PlayerTitleDTO title = PlayerTitleDTO.get(Integer.parseInt(args[1]));
|
||||||
if (title == null) {
|
if (title == null) {
|
||||||
MiniPlayerTitle.notification.error(sender, "称号不存在");
|
Notification.error(sender, "称号不存在");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!title.getPlayerUuid().equals(player.getUniqueId())) {
|
if (!title.getPlayerUuid().equals(player.getUniqueId())) {
|
||||||
MiniPlayerTitle.notification.error(sender, "该称号不属于你");
|
Notification.error(sender, "该称号不属于你");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PlayerInfoDTO playerInfo = PlayerInfoDTO.get((player).getUniqueId());
|
PlayerInfoDTO playerInfo = PlayerInfoDTO.get((player).getUniqueId());
|
||||||
if (playerInfo == null) {
|
if (playerInfo == null) {
|
||||||
MiniPlayerTitle.notification.error(sender, "获取玩家信息时出现错误");
|
Notification.error(sender, "获取玩家信息时出现错误");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (title.isExpired()) {
|
if (title.isExpired()) {
|
||||||
MiniPlayerTitle.notification.error(sender, "称号 %s 已过期", title.getTitle().getTitlePlainText());
|
Notification.error(sender, "称号 %s 已过期", title.getTitle().getTitlePlainText());
|
||||||
playerInfo.setUsingTitle(null);
|
playerInfo.setUsingTitle(null);
|
||||||
updateName(player, null);
|
updateName(player, null);
|
||||||
return;
|
return;
|
||||||
@ -172,9 +171,9 @@ public class TitleManage {
|
|||||||
boolean success = playerInfo.setUsingTitle(title.getTitle());
|
boolean success = playerInfo.setUsingTitle(title.getTitle());
|
||||||
if (success) {
|
if (success) {
|
||||||
updateName((Player) sender, title.getTitle());
|
updateName((Player) sender, title.getTitle());
|
||||||
MiniPlayerTitle.notification.info(sender, "已使用称号");
|
Notification.info(sender, "已使用称号");
|
||||||
} else {
|
} else {
|
||||||
MiniPlayerTitle.notification.error(sender, "使用称号失败,具体请查看控制台日志");
|
Notification.error(sender, "使用称号失败,具体请查看控制台日志");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.length == 3) {
|
if (args.length == 3) {
|
||||||
@ -192,45 +191,45 @@ public class TitleManage {
|
|||||||
*/
|
*/
|
||||||
public static void customTitle(CommandSender sender, String[] args) {
|
public static void customTitle(CommandSender sender, String[] args) {
|
||||||
if (!(sender instanceof Player)) {
|
if (!(sender instanceof Player)) {
|
||||||
MiniPlayerTitle.notification.error(sender, "该命令只能由玩家执行");
|
Notification.error(sender, "该命令只能由玩家执行");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
if (!MiniPlayerTitle.config.isEnableCustom()) {
|
if (!MiniPlayerTitle.config.isEnableCustom()) {
|
||||||
MiniPlayerTitle.notification.error(sender, "自定义称号功能已关闭");
|
Notification.error(sender, "自定义称号功能已关闭");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PlayerInfoDTO playerInfo = PlayerInfoDTO.get(player.getUniqueId());
|
PlayerInfoDTO playerInfo = PlayerInfoDTO.get(player.getUniqueId());
|
||||||
if (playerInfo == null) {
|
if (playerInfo == null) {
|
||||||
MiniPlayerTitle.notification.error(sender, "获取玩家信息时出现错误");
|
Notification.error(sender, "获取玩家信息时出现错误");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (MiniPlayerTitle.config.getCustomCost() > playerInfo.getCoin()) {
|
if (MiniPlayerTitle.config.getCustomCost() > playerInfo.getCoin()) {
|
||||||
MiniPlayerTitle.notification.error(sender, "称号币不足");
|
Notification.error(sender, "称号币不足");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (args.length < 2) {
|
if (args.length < 2) {
|
||||||
MiniPlayerTitle.notification.warn(sender, "用法: /mplt custom_title <称号>");
|
Notification.warn(sender, "用法: /mplt custom_title <称号>");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
TitleDTO title = TitleDTO.create(args[1], player.getName() + "的自定义称号");
|
TitleDTO title = TitleDTO.create(args[1], player.getName() + "的自定义称号");
|
||||||
if (title == null) {
|
if (title == null) {
|
||||||
MiniPlayerTitle.notification.error(sender, "创建称号失败,具体请查看控制台日志");
|
Notification.error(sender, "创建称号失败,具体请查看控制台日志");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (title.getTitlePlainText().length() > MiniPlayerTitle.config.getMaxLength()) {
|
if (title.getTitlePlainText().length() > MiniPlayerTitle.config.getMaxLength()) {
|
||||||
MiniPlayerTitle.notification.error(sender, "称号长度超过限制");
|
Notification.error(sender, "称号长度超过限制");
|
||||||
title.delete();
|
title.delete();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PlayerTitleDTO created_rec = PlayerTitleDTO.create(player.getUniqueId(), title, null);
|
PlayerTitleDTO created_rec = PlayerTitleDTO.create(player.getUniqueId(), title, null);
|
||||||
if (created_rec == null) {
|
if (created_rec == null) {
|
||||||
MiniPlayerTitle.notification.error(sender, "创建称号记录失败,具体请查看控制台日志");
|
Notification.error(sender, "创建称号记录失败,具体请查看控制台日志");
|
||||||
title.delete();
|
title.delete();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
playerInfo.setCoin(playerInfo.getCoin() - MiniPlayerTitle.config.getCustomCost());
|
playerInfo.setCoin(playerInfo.getCoin() - MiniPlayerTitle.config.getCustomCost());
|
||||||
MiniPlayerTitle.notification.info(sender, "成功创建自定义称号");
|
Notification.info(sender, "成功创建自定义称号");
|
||||||
MyTitles.show(sender, new String[]{"my_titles"});
|
MyTitles.show(sender, new String[]{"my_titles"});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package cn.lunadeer.miniplayertitle.commands;
|
package cn.lunadeer.miniplayertitle.commands;
|
||||||
|
|
||||||
import cn.lunadeer.miniplayertitle.MiniPlayerTitle;
|
import cn.lunadeer.minecraftpluginutils.Notification;
|
||||||
import cn.lunadeer.miniplayertitle.dtos.PlayerInfoDTO;
|
import cn.lunadeer.miniplayertitle.dtos.PlayerInfoDTO;
|
||||||
import cn.lunadeer.miniplayertitle.dtos.PlayerTitleDTO;
|
import cn.lunadeer.miniplayertitle.dtos.PlayerTitleDTO;
|
||||||
import cn.lunadeer.miniplayertitle.dtos.TitleDTO;
|
import cn.lunadeer.miniplayertitle.dtos.TitleDTO;
|
||||||
@ -33,7 +33,7 @@ public class TitleShopSale {
|
|||||||
if (notOpOrConsole(sender)) return;
|
if (notOpOrConsole(sender)) return;
|
||||||
TitleShopDTO titleShop = TitleShopDTO.get(Integer.valueOf(args[2]));
|
TitleShopDTO titleShop = TitleShopDTO.get(Integer.valueOf(args[2]));
|
||||||
if (titleShop == null) {
|
if (titleShop == null) {
|
||||||
MiniPlayerTitle.notification.error(sender, "获取详情时出现错误,详情请查看控制台日志");
|
Notification.error(sender, "获取详情时出现错误,详情请查看控制台日志");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
boolean success;
|
boolean success;
|
||||||
@ -63,11 +63,11 @@ public class TitleShopSale {
|
|||||||
success = titleShop.setSaleEndAt(titleShop.getSaleEndAt().minusDays(days2));
|
success = titleShop.setSaleEndAt(titleShop.getSaleEndAt().minusDays(days2));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
MiniPlayerTitle.notification.warn(sender, "用法: /mplt set_sale <price|days|amount|end_at|end_at_y|end_at_m|end_at_d> <商品ID> <值> [页数]");
|
Notification.warn(sender, "用法: /mplt set_sale <price|days|amount|end_at|end_at_y|end_at_m|end_at_d> <商品ID> <值> [页数]");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!success) {
|
if (!success) {
|
||||||
MiniPlayerTitle.notification.error(sender, "设置商品信息时出现错误,详情请查看控制台日志");
|
Notification.error(sender, "设置商品信息时出现错误,详情请查看控制台日志");
|
||||||
}
|
}
|
||||||
if (args.length == 5) {
|
if (args.length == 5) {
|
||||||
int page = getLastArgsPage(args);
|
int page = getLastArgsPage(args);
|
||||||
@ -86,15 +86,15 @@ public class TitleShopSale {
|
|||||||
if (notOpOrConsole(sender)) return;
|
if (notOpOrConsole(sender)) return;
|
||||||
TitleDTO title = TitleDTO.get(Integer.parseInt(args[1]));
|
TitleDTO title = TitleDTO.get(Integer.parseInt(args[1]));
|
||||||
if (title == null) {
|
if (title == null) {
|
||||||
MiniPlayerTitle.notification.error(sender, "获取称号详情时出现错误,详情请查看控制台日志");
|
Notification.error(sender, "获取称号详情时出现错误,详情请查看控制台日志");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
TitleShopDTO sale = TitleShopDTO.create(title);
|
TitleShopDTO sale = TitleShopDTO.create(title);
|
||||||
if (sale == null) {
|
if (sale == null) {
|
||||||
MiniPlayerTitle.notification.error(sender, "创建商品时出现错误,详情请查看控制台日志");
|
Notification.error(sender, "创建商品时出现错误,详情请查看控制台日志");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MiniPlayerTitle.notification.info(sender, "已创建称号商品");
|
Notification.info(sender, "已创建称号商品");
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
SaleInfo.show(sender, new String[]{"sale_info", String.valueOf(sale.getId())});
|
SaleInfo.show(sender, new String[]{"sale_info", String.valueOf(sale.getId())});
|
||||||
}
|
}
|
||||||
@ -111,14 +111,14 @@ public class TitleShopSale {
|
|||||||
if (notOpOrConsole(sender)) return;
|
if (notOpOrConsole(sender)) return;
|
||||||
TitleShopDTO titleShop = TitleShopDTO.get(Integer.valueOf(args[1]));
|
TitleShopDTO titleShop = TitleShopDTO.get(Integer.valueOf(args[1]));
|
||||||
if (titleShop == null) {
|
if (titleShop == null) {
|
||||||
MiniPlayerTitle.notification.error(sender, "获取详情时出现错误");
|
Notification.error(sender, "获取详情时出现错误");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
boolean success = titleShop.delete();
|
boolean success = titleShop.delete();
|
||||||
if (success) {
|
if (success) {
|
||||||
MiniPlayerTitle.notification.info(sender, "已删除商品");
|
Notification.info(sender, "已删除商品");
|
||||||
} else {
|
} else {
|
||||||
MiniPlayerTitle.notification.error(sender, "删除商品时出现错误,详情请查看控制台日志");
|
Notification.error(sender, "删除商品时出现错误,详情请查看控制台日志");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.length == 3) {
|
if (args.length == 3) {
|
||||||
@ -135,31 +135,31 @@ public class TitleShopSale {
|
|||||||
*/
|
*/
|
||||||
public static void buySale(CommandSender sender, String[] args) {
|
public static void buySale(CommandSender sender, String[] args) {
|
||||||
if (!(sender instanceof Player)) {
|
if (!(sender instanceof Player)) {
|
||||||
MiniPlayerTitle.notification.error(sender, "该命令只能由玩家执行");
|
Notification.error(sender, "该命令只能由玩家执行");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
PlayerInfoDTO playerInfo = PlayerInfoDTO.get(player.getUniqueId());
|
PlayerInfoDTO playerInfo = PlayerInfoDTO.get(player.getUniqueId());
|
||||||
if (playerInfo == null) {
|
if (playerInfo == null) {
|
||||||
MiniPlayerTitle.notification.error(player, "获取玩家信息时出现错误,详情请查看控制台日志");
|
Notification.error(player, "获取玩家信息时出现错误,详情请查看控制台日志");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
TitleShopDTO titleShop = TitleShopDTO.get(Integer.valueOf(args[1]));
|
TitleShopDTO titleShop = TitleShopDTO.get(Integer.valueOf(args[1]));
|
||||||
if (titleShop == null) {
|
if (titleShop == null) {
|
||||||
MiniPlayerTitle.notification.error(player, "获取详情时出现错误,详情请查看控制台日志");
|
Notification.error(player, "获取详情时出现错误,详情请查看控制台日志");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (titleShop.isExpired() || titleShop.getDays() == 0) {
|
if (titleShop.isExpired() || titleShop.getDays() == 0) {
|
||||||
MiniPlayerTitle.notification.error(player, "此称号已停止销售");
|
Notification.error(player, "此称号已停止销售");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (titleShop.getAmount() != -1 && titleShop.getAmount() <= 0) {
|
if (titleShop.getAmount() != -1 && titleShop.getAmount() <= 0) {
|
||||||
MiniPlayerTitle.notification.error(player, "此称号已售罄");
|
Notification.error(player, "此称号已售罄");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (titleShop.getPrice() > playerInfo.getCoin()) {
|
if (titleShop.getPrice() > playerInfo.getCoin()) {
|
||||||
MiniPlayerTitle.notification.error(player, "你的余额不足");
|
Notification.error(player, "你的余额不足");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -175,19 +175,19 @@ public class TitleShopSale {
|
|||||||
if (had == null) {
|
if (had == null) {
|
||||||
had = PlayerTitleDTO.create(player.getUniqueId(), titleShop.getTitle(), titleShop.getDays() == -1 ? null : LocalDateTime.now().plusDays(titleShop.getDays()));
|
had = PlayerTitleDTO.create(player.getUniqueId(), titleShop.getTitle(), titleShop.getDays() == -1 ? null : LocalDateTime.now().plusDays(titleShop.getDays()));
|
||||||
if (had == null) {
|
if (had == null) {
|
||||||
MiniPlayerTitle.notification.error(player, "购买称号时出现错误,详情请查看控制台日志");
|
Notification.error(player, "购买称号时出现错误,详情请查看控制台日志");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
titleShop.setAmount(titleShop.getAmount() - 1);
|
titleShop.setAmount(titleShop.getAmount() - 1);
|
||||||
playerInfo.setCoin(playerInfo.getCoin() - titleShop.getPrice());
|
playerInfo.setCoin(playerInfo.getCoin() - titleShop.getPrice());
|
||||||
MiniPlayerTitle.notification.info(player, Component.text("成功购买称号: ").append(had.getTitle().getTitleColored()));
|
Notification.info(player, Component.text("成功购买称号: ").append(had.getTitle().getTitleColored()));
|
||||||
} else if (!had.isExpired()) {
|
} else if (!had.isExpired()) {
|
||||||
MiniPlayerTitle.notification.warn(player, "你已拥有此称号,在过期前无法再次购买");
|
Notification.warn(player, "你已拥有此称号,在过期前无法再次购买");
|
||||||
} else {
|
} else {
|
||||||
had.setExpireAt(titleShop.getDays() == -1 ? null : LocalDateTime.now().plusDays(titleShop.getDays()));
|
had.setExpireAt(titleShop.getDays() == -1 ? null : LocalDateTime.now().plusDays(titleShop.getDays()));
|
||||||
titleShop.setAmount(titleShop.getAmount() - 1);
|
titleShop.setAmount(titleShop.getAmount() - 1);
|
||||||
playerInfo.setCoin(playerInfo.getCoin() - titleShop.getPrice());
|
playerInfo.setCoin(playerInfo.getCoin() - titleShop.getPrice());
|
||||||
MiniPlayerTitle.notification.info(player, Component.text("成功续续期称号: ").append(had.getTitle().getTitleColored()));
|
Notification.info(player, Component.text("成功续续期称号: ").append(had.getTitle().getTitleColored()));
|
||||||
}
|
}
|
||||||
|
|
||||||
int page = getArgPage(args, 3);
|
int page = getArgPage(args, 3);
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package cn.lunadeer.miniplayertitle.dtos;
|
package cn.lunadeer.miniplayertitle.dtos;
|
||||||
|
|
||||||
import cn.lunadeer.minecraftpluginutils.VaultConnect;
|
import cn.lunadeer.minecraftpluginutils.VaultConnect;
|
||||||
|
import cn.lunadeer.minecraftpluginutils.XLogger;
|
||||||
import cn.lunadeer.miniplayertitle.MiniPlayerTitle;
|
import cn.lunadeer.miniplayertitle.MiniPlayerTitle;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@ -34,13 +35,13 @@ public class PlayerInfoDTO {
|
|||||||
if (info == null) {
|
if (info == null) {
|
||||||
info = create(player);
|
info = create(player);
|
||||||
if (info == null) {
|
if (info == null) {
|
||||||
MiniPlayerTitle.logger.err("创建玩家信息时失败");
|
XLogger.err("创建玩家信息时失败");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
info = updateName(player);
|
info = updateName(player);
|
||||||
if (info == null) {
|
if (info == null) {
|
||||||
MiniPlayerTitle.logger.err("更新玩家名称时失败");
|
XLogger.err("更新玩家名称时失败");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
package cn.lunadeer.miniplayertitle.tuis;
|
package cn.lunadeer.miniplayertitle.tuis;
|
||||||
|
|
||||||
import cn.lunadeer.miniplayertitle.MiniPlayerTitle;
|
import cn.lunadeer.minecraftpluginutils.Notification;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class Apis {
|
public class Apis {
|
||||||
public static Player playerOnly(CommandSender sender) {
|
public static Player playerOnly(CommandSender sender) {
|
||||||
if (!(sender instanceof Player)) {
|
if (!(sender instanceof Player)) {
|
||||||
MiniPlayerTitle.notification.error(sender, "该命令只能由玩家执行");
|
Notification.error(sender, "该命令只能由玩家执行");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return (Player) sender;
|
return (Player) sender;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package cn.lunadeer.miniplayertitle.tuis;
|
package cn.lunadeer.miniplayertitle.tuis;
|
||||||
|
|
||||||
|
import cn.lunadeer.minecraftpluginutils.Notification;
|
||||||
import cn.lunadeer.minecraftpluginutils.stui.ListView;
|
import cn.lunadeer.minecraftpluginutils.stui.ListView;
|
||||||
import cn.lunadeer.minecraftpluginutils.stui.components.Button;
|
import cn.lunadeer.minecraftpluginutils.stui.components.Button;
|
||||||
import cn.lunadeer.minecraftpluginutils.stui.components.Line;
|
import cn.lunadeer.minecraftpluginutils.stui.components.Line;
|
||||||
@ -20,7 +21,7 @@ public class Menu {
|
|||||||
|
|
||||||
PlayerInfoDTO playerInfo = PlayerInfoDTO.get(player.getUniqueId());
|
PlayerInfoDTO playerInfo = PlayerInfoDTO.get(player.getUniqueId());
|
||||||
if (playerInfo == null) {
|
if (playerInfo == null) {
|
||||||
MiniPlayerTitle.notification.error(player, "获取玩家信息时出现错误");
|
Notification.error(player, "获取玩家信息时出现错误");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Line balance = Line.create()
|
Line balance = Line.create()
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package cn.lunadeer.miniplayertitle.tuis;
|
package cn.lunadeer.miniplayertitle.tuis;
|
||||||
|
|
||||||
|
import cn.lunadeer.minecraftpluginutils.Notification;
|
||||||
import cn.lunadeer.minecraftpluginutils.stui.ListView;
|
import cn.lunadeer.minecraftpluginutils.stui.ListView;
|
||||||
import cn.lunadeer.minecraftpluginutils.stui.components.Button;
|
import cn.lunadeer.minecraftpluginutils.stui.components.Button;
|
||||||
import cn.lunadeer.minecraftpluginutils.stui.components.Line;
|
import cn.lunadeer.minecraftpluginutils.stui.components.Line;
|
||||||
import cn.lunadeer.miniplayertitle.MiniPlayerTitle;
|
|
||||||
import cn.lunadeer.miniplayertitle.dtos.PlayerInfoDTO;
|
import cn.lunadeer.miniplayertitle.dtos.PlayerInfoDTO;
|
||||||
import cn.lunadeer.miniplayertitle.dtos.PlayerTitleDTO;
|
import cn.lunadeer.miniplayertitle.dtos.PlayerTitleDTO;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -24,7 +24,7 @@ public class MyTitles {
|
|||||||
|
|
||||||
PlayerInfoDTO playerInfo = PlayerInfoDTO.get(player.getUniqueId());
|
PlayerInfoDTO playerInfo = PlayerInfoDTO.get(player.getUniqueId());
|
||||||
if (playerInfo == null) {
|
if (playerInfo == null) {
|
||||||
MiniPlayerTitle.notification.error(player, "获取玩家信息时出现错误,详情请查看控制台日志");
|
Notification.error(player, "获取玩家信息时出现错误,详情请查看控制台日志");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
List<PlayerTitleDTO> titles = PlayerTitleDTO.getAllOf(player.getUniqueId());
|
List<PlayerTitleDTO> titles = PlayerTitleDTO.getAllOf(player.getUniqueId());
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package cn.lunadeer.miniplayertitle.tuis;
|
package cn.lunadeer.miniplayertitle.tuis;
|
||||||
|
|
||||||
|
import cn.lunadeer.minecraftpluginutils.Notification;
|
||||||
import cn.lunadeer.minecraftpluginutils.stui.ListView;
|
import cn.lunadeer.minecraftpluginutils.stui.ListView;
|
||||||
import cn.lunadeer.minecraftpluginutils.stui.components.Button;
|
import cn.lunadeer.minecraftpluginutils.stui.components.Button;
|
||||||
import cn.lunadeer.minecraftpluginutils.stui.components.Line;
|
import cn.lunadeer.minecraftpluginutils.stui.components.Line;
|
||||||
import cn.lunadeer.minecraftpluginutils.stui.components.NumChanger;
|
import cn.lunadeer.minecraftpluginutils.stui.components.NumChanger;
|
||||||
import cn.lunadeer.miniplayertitle.MiniPlayerTitle;
|
|
||||||
import cn.lunadeer.miniplayertitle.dtos.TitleDTO;
|
import cn.lunadeer.miniplayertitle.dtos.TitleDTO;
|
||||||
import cn.lunadeer.miniplayertitle.dtos.TitleShopDTO;
|
import cn.lunadeer.miniplayertitle.dtos.TitleShopDTO;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
@ -23,12 +23,12 @@ public class SaleInfo {
|
|||||||
int page = getArgPage(args, 3);
|
int page = getArgPage(args, 3);
|
||||||
TitleShopDTO titleShop = TitleShopDTO.get(Integer.valueOf(args[1]));
|
TitleShopDTO titleShop = TitleShopDTO.get(Integer.valueOf(args[1]));
|
||||||
if (titleShop == null) {
|
if (titleShop == null) {
|
||||||
MiniPlayerTitle.notification.error(player, "获取详情时出现错误");
|
Notification.error(player, "获取详情时出现错误");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
TitleDTO title = titleShop.getTitle();
|
TitleDTO title = titleShop.getTitle();
|
||||||
if (title == null) {
|
if (title == null) {
|
||||||
MiniPlayerTitle.notification.error(player, "获取详情时出现错误");
|
Notification.error(player, "获取详情时出现错误");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int now_year = LocalDateTime.now().getYear();
|
int now_year = LocalDateTime.now().getYear();
|
||||||
|
@ -16,10 +16,6 @@ public class ConfigManager {
|
|||||||
_file = _plugin.getConfig();
|
_file = _plugin.getConfig();
|
||||||
_debug = _file.getBoolean("Debug", false);
|
_debug = _file.getBoolean("Debug", false);
|
||||||
_db_type = _file.getString("Database.Type", "sqlite");
|
_db_type = _file.getString("Database.Type", "sqlite");
|
||||||
if (!_db_type.equals("pgsql") && !_db_type.equals("sqlite")) {
|
|
||||||
MiniPlayerTitle.logger.err("当前数据库只支持 pgsql 或 sqlite,已重置为 sqlite");
|
|
||||||
setDbType("sqlite");
|
|
||||||
}
|
|
||||||
_db_host = _file.getString("Database.Host", "localhost");
|
_db_host = _file.getString("Database.Host", "localhost");
|
||||||
_db_port = _file.getString("Database.Port", "5432");
|
_db_port = _file.getString("Database.Port", "5432");
|
||||||
_db_name = _file.getString("Database.Name", "miniplayertitle");
|
_db_name = _file.getString("Database.Name", "miniplayertitle");
|
||||||
|
Loading…
Reference in New Issue
Block a user