@
领地系统:修复DB列数不匹配(59→61) + 用户UI偏好设置 - 修复saveAreaToDb INSERT语句缺少2个?占位符(warp_pitch/warp_world) - 新增 /protect uimode cli|gui 命令切换UI偏好 - 主菜单39号位添加领地系统入口,读取偏好决定GUI/CLI - /protect无参数时读取偏好,自动选择GUI或CLI模式 @
This commit is contained in:
@@ -4455,6 +4455,25 @@ public class AreaProtection implements Listener {
|
||||
String[] args) {
|
||||
args = smartReorderArgs(args);
|
||||
if (args.length == 0) {
|
||||
// ★ 读取用户偏好决定打开GUI还是CLI
|
||||
if (sender instanceof Player) {
|
||||
Player p = (Player) sender;
|
||||
int uiMode = 1;
|
||||
try {
|
||||
uiMode = plugin.getDb()
|
||||
.getUiMode(p.getName());
|
||||
} catch (Exception ignored) {}
|
||||
if (uiMode == 0) {
|
||||
// GUI模式 → 打开领地管理GUI
|
||||
if (plugin.areaGUIManager != null) {
|
||||
plugin.areaGUIManager.openMainMenu(p);
|
||||
} else {
|
||||
p.sendMessage("§cGUI管理器未初始化,显示文本帮助");
|
||||
showHelp(sender);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
showHelp(sender);
|
||||
return true;
|
||||
}
|
||||
@@ -4566,6 +4585,36 @@ public class AreaProtection implements Listener {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ===== UI模式偏好 =====
|
||||
if (sub.equals("uimode") || sub.equals("偏好")) {
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage("§c仅玩家可用");
|
||||
return true;
|
||||
}
|
||||
Player p = (Player) sender;
|
||||
if (args.length < 2) {
|
||||
int current = plugin.getDb()
|
||||
.getUiMode(p.getName());
|
||||
p.sendMessage("§e当前模式: §f"
|
||||
+ (current == 0 ? "GUI" : "CLI"));
|
||||
p.sendMessage("§7用法: /protect uimode <gui|cli>");
|
||||
return true;
|
||||
}
|
||||
String mode = args[1].toLowerCase();
|
||||
if (mode.equals("gui") || mode.equals("0")) {
|
||||
plugin.getDb().setUiMode(p.getName(), 0);
|
||||
p.sendMessage("§a已切换为 §6GUI §a模式");
|
||||
p.sendMessage("§7下次输入 /protect 将打开GUI菜单");
|
||||
} else if (mode.equals("cli") || mode.equals("1")) {
|
||||
plugin.getDb().setUiMode(p.getName(), 1);
|
||||
p.sendMessage("§a已切换为 §6CLI §a模式");
|
||||
p.sendMessage("§7下次输入 /protect 将显示文本帮助");
|
||||
} else {
|
||||
p.sendMessage("§c用法: /protect uimode <gui|cli>");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// ===== 创建 =====
|
||||
if (sub.equals("创建") || sub.equals("create")) {
|
||||
if (!(sender instanceof Player)) {
|
||||
@@ -5975,7 +6024,7 @@ public class AreaProtection implements Listener {
|
||||
+ "deny_thrown_projectiles, deny_glowing, deny_redstone_interaction, deny_door_interaction, "
|
||||
+ "deny_noteblock_jukebox, deny_lead, deny_crop_harvest, deny_wool_shear, deny_animal_feeding, "
|
||||
+ "warp_x, warp_y, warp_z, warp_yaw, warp_pitch, warp_world) "
|
||||
+ "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
||||
+ "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
||||
|
||||
stmt.setString(1, ac.name);
|
||||
stmt.setString(2, ac.owner != null ? ac.owner : "");
|
||||
@@ -6226,6 +6275,9 @@ public class AreaProtection implements Listener {
|
||||
sendClickableHelp(s, "/protect shop my", "查看我的权限");
|
||||
sendClickableHelp(s, "/protect info", "当前领地信息");
|
||||
|
||||
s.sendMessage("§e§l---- 设置 ----");
|
||||
sendClickableHelp(s, "/protect uimode", "切换UI模式(GUI/CLI)");
|
||||
|
||||
s.sendMessage("§b§l欢迎游玩草原探险服务器");
|
||||
s.sendMessage("§b§l服务器ip:mc2.ypshidifu.cn 端口30679");
|
||||
}
|
||||
|
||||
@@ -217,6 +217,20 @@ public class GUIManager implements Listener {
|
||||
"§7给钱、扣钱"));
|
||||
}
|
||||
|
||||
// ★ 领地系统 - 39号位(读取用户偏好)
|
||||
int landUiMode = 1;
|
||||
try {
|
||||
landUiMode = plugin.getDb()
|
||||
.getUiMode(p.getName());
|
||||
} catch (Exception ignored) {}
|
||||
g.setItem(39, mkItem(Material.GRASS_BLOCK,
|
||||
"§a§l领地系统",
|
||||
"§7管理你的领地和权限",
|
||||
"",
|
||||
landUiMode == 0
|
||||
? "§e点击打开GUI"
|
||||
: "§e点击打开CLI"));
|
||||
|
||||
|
||||
|
||||
// ===== Row0(0-8): 自定义菜单项 =====
|
||||
|
||||
@@ -3537,6 +3537,25 @@ public class Main extends JavaPlugin
|
||||
if (p.isOp() || isAdmin(p)) {
|
||||
gui.openBalanceOps(p);
|
||||
}
|
||||
} else if (slot == 39) {
|
||||
// ★ 领地系统入口 - 读取用户偏好
|
||||
int uiMode = 1;
|
||||
try {
|
||||
uiMode = getDb()
|
||||
.getUiMode(p.getName());
|
||||
} catch (Exception ignored) {}
|
||||
p.closeInventory();
|
||||
if (uiMode == 0) {
|
||||
// GUI模式
|
||||
if (areaGUIManager != null) {
|
||||
areaGUIManager.openMainMenu(p);
|
||||
} else {
|
||||
p.sendMessage("§c领地管理器未初始化");
|
||||
}
|
||||
} else {
|
||||
// CLI模式
|
||||
Bukkit.dispatchCommand(p, "protect menu");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user