优化代码结构,修复了某些指令输入错误时缺少提示的问题
Some checks failed
Java CI-CD with Gradle / build (push) Failing after 7m50s
Some checks failed
Java CI-CD with Gradle / build (push) Failing after 7m50s
This commit is contained in:
parent
6978e4f05b
commit
765fef5c66
@ -4,7 +4,7 @@ plugins {
|
||||
}
|
||||
|
||||
group = "cn.lunadeer"
|
||||
version = "2.1.20-beta"
|
||||
version = "2.1.21-beta"
|
||||
|
||||
java {
|
||||
toolchain.languageVersion.set(JavaLanguageVersion.of(21))
|
||||
|
@ -10,6 +10,7 @@ import cn.lunadeer.dominion.tuis.dominion.DominionManage;
|
||||
import cn.lunadeer.dominion.tuis.dominion.manage.EnvSetting;
|
||||
import cn.lunadeer.dominion.tuis.dominion.manage.GuestSetting;
|
||||
import cn.lunadeer.dominion.tuis.dominion.manage.SizeInfo;
|
||||
import cn.lunadeer.dominion.utils.TuiUtils;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabExecutor;
|
||||
@ -51,7 +52,7 @@ public class Commands implements TabExecutor {
|
||||
DominionList.show(sender, args);
|
||||
break;
|
||||
case "help":
|
||||
cn.lunadeer.dominion.tuis.Apis.printHelp(sender, args);
|
||||
TuiUtils.printHelp(sender, args);
|
||||
break;
|
||||
case "info":
|
||||
SizeInfo.show(sender, args);
|
||||
|
@ -1,6 +1,5 @@
|
||||
package cn.lunadeer.dominion;
|
||||
|
||||
import cn.lunadeer.dominion.events.RegisterEvents;
|
||||
import cn.lunadeer.dominion.managers.ConfigManager;
|
||||
import cn.lunadeer.dominion.managers.DatabaseTables;
|
||||
import cn.lunadeer.dominion.managers.PlaceHolderApi;
|
||||
@ -49,7 +48,7 @@ public final class Dominion extends JavaPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
new RegisterEvents(this);
|
||||
new EventsRegister(this);
|
||||
Objects.requireNonNull(Bukkit.getPluginCommand("dominion")).setExecutor(new Commands());
|
||||
|
||||
bStatsMetrics metrics = new bStatsMetrics(this, 21445);
|
||||
|
@ -1,15 +1,15 @@
|
||||
package cn.lunadeer.dominion.events;
|
||||
package cn.lunadeer.dominion;
|
||||
|
||||
import cn.lunadeer.minecraftpluginutils.XLogger;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class RegisterEvents {
|
||||
public class EventsRegister {
|
||||
|
||||
private JavaPlugin plugin;
|
||||
|
||||
public RegisterEvents(JavaPlugin plugin) {
|
||||
public EventsRegister(JavaPlugin plugin) {
|
||||
APIVersion version = GetAPIVersion(plugin);
|
||||
this.plugin = plugin;
|
||||
if (version == null) {
|
@ -8,7 +8,7 @@ import cn.lunadeer.dominion.tuis.dominion.manage.GuestSetting;
|
||||
import cn.lunadeer.minecraftpluginutils.Notification;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import static cn.lunadeer.dominion.commands.Apis.hasPermission;
|
||||
import static cn.lunadeer.dominion.utils.CommandUtils.hasPermission;
|
||||
|
||||
public class DominionFlag {
|
||||
|
||||
|
@ -21,8 +21,8 @@ import java.time.LocalDateTime;
|
||||
import java.util.Map;
|
||||
|
||||
import static cn.lunadeer.dominion.DominionNode.isInDominion;
|
||||
import static cn.lunadeer.dominion.commands.Apis.*;
|
||||
import static cn.lunadeer.dominion.events.Apis.canByPass;
|
||||
import static cn.lunadeer.dominion.utils.CommandUtils.*;
|
||||
import static cn.lunadeer.dominion.utils.EventUtils.canByPass;
|
||||
|
||||
public class DominionOperate {
|
||||
/**
|
||||
|
@ -16,9 +16,9 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.lunadeer.dominion.Commands.boolOptions;
|
||||
import static cn.lunadeer.dominion.commands.Apis.hasPermission;
|
||||
import static cn.lunadeer.dominion.utils.CommandUtils.hasPermission;
|
||||
import static cn.lunadeer.dominion.commands.Helper.*;
|
||||
import static cn.lunadeer.dominion.tuis.Apis.getPage;
|
||||
import static cn.lunadeer.dominion.utils.TuiUtils.getPage;
|
||||
|
||||
public class Group {
|
||||
|
||||
@ -181,6 +181,10 @@ public class Group {
|
||||
}
|
||||
|
||||
public static void handle(@NotNull CommandSender sender, @NotNull String[] args) {
|
||||
if (args.length < 2) {
|
||||
Notification.error(sender, "用法: /dominion group <create|delete|rename|set_flag|add_member|remove_member|select_member|setting|list>");
|
||||
return;
|
||||
}
|
||||
switch (args[1]) {
|
||||
case "create":
|
||||
createGroup(sender, args);
|
||||
|
@ -9,7 +9,7 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.lunadeer.dominion.commands.Apis.playerOnly;
|
||||
import static cn.lunadeer.dominion.utils.CommandUtils.playerOnly;
|
||||
|
||||
public class Helper {
|
||||
|
||||
|
@ -17,7 +17,7 @@ import java.util.List;
|
||||
|
||||
import static cn.lunadeer.dominion.Commands.boolOptions;
|
||||
import static cn.lunadeer.dominion.Commands.playerNames;
|
||||
import static cn.lunadeer.dominion.commands.Apis.hasPermission;
|
||||
import static cn.lunadeer.dominion.utils.CommandUtils.hasPermission;
|
||||
import static cn.lunadeer.dominion.commands.Helper.*;
|
||||
|
||||
public class Member {
|
||||
@ -131,6 +131,10 @@ public class Member {
|
||||
}
|
||||
|
||||
public static void handle(@NotNull CommandSender sender, @NotNull String[] args) {
|
||||
if (args.length < 2) {
|
||||
Notification.error(sender, "用法: /dominion member <add/set_flag/remove/apply_template/list/setting/select_player/select_template>");
|
||||
return;
|
||||
}
|
||||
switch (args[1]) {
|
||||
case "add":
|
||||
Member.member_add(sender, args);
|
||||
|
@ -14,8 +14,8 @@ import org.bukkit.entity.Player;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import static cn.lunadeer.dominion.commands.Apis.hasPermission;
|
||||
import static cn.lunadeer.dominion.commands.Apis.playerOnly;
|
||||
import static cn.lunadeer.dominion.utils.CommandUtils.hasPermission;
|
||||
import static cn.lunadeer.dominion.utils.CommandUtils.playerOnly;
|
||||
|
||||
public class Migration {
|
||||
|
||||
|
@ -17,7 +17,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static cn.lunadeer.dominion.commands.Apis.hasPermission;
|
||||
import static cn.lunadeer.dominion.utils.CommandUtils.hasPermission;
|
||||
|
||||
|
||||
public class Operator {
|
||||
|
@ -5,7 +5,7 @@ import cn.lunadeer.dominion.tuis.SysConfig;
|
||||
import cn.lunadeer.minecraftpluginutils.Notification;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import static cn.lunadeer.dominion.commands.Apis.hasPermission;
|
||||
import static cn.lunadeer.dominion.utils.CommandUtils.hasPermission;
|
||||
|
||||
public class SetConfig {
|
||||
|
||||
|
@ -15,11 +15,11 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.lunadeer.dominion.Commands.boolOptions;
|
||||
import static cn.lunadeer.dominion.commands.Apis.hasPermission;
|
||||
import static cn.lunadeer.dominion.commands.Apis.playerOnly;
|
||||
import static cn.lunadeer.dominion.utils.CommandUtils.hasPermission;
|
||||
import static cn.lunadeer.dominion.utils.CommandUtils.playerOnly;
|
||||
import static cn.lunadeer.dominion.commands.Helper.allTemplates;
|
||||
import static cn.lunadeer.dominion.commands.Helper.playerPrivileges;
|
||||
import static cn.lunadeer.dominion.tuis.Apis.getPage;
|
||||
import static cn.lunadeer.dominion.utils.TuiUtils.getPage;
|
||||
|
||||
public class Template {
|
||||
|
||||
@ -106,6 +106,10 @@ public class Template {
|
||||
|
||||
|
||||
public static void handle(@NotNull CommandSender sender, @NotNull String[] args) {
|
||||
if (args.length < 2) {
|
||||
Notification.error(sender, "用法: /dominion template <list|setting|delete|create|set_flag>");
|
||||
return;
|
||||
}
|
||||
switch (args[1]) {
|
||||
case "list":
|
||||
TemplateList.show(sender, args);
|
||||
|
@ -12,9 +12,9 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import static cn.lunadeer.dominion.commands.Apis.hasPermission;
|
||||
import static cn.lunadeer.dominion.commands.Apis.playerOnly;
|
||||
import static cn.lunadeer.dominion.tuis.Apis.getPage;
|
||||
import static cn.lunadeer.dominion.utils.CommandUtils.hasPermission;
|
||||
import static cn.lunadeer.dominion.utils.CommandUtils.playerOnly;
|
||||
import static cn.lunadeer.dominion.utils.TuiUtils.getPage;
|
||||
|
||||
public class Title {
|
||||
|
||||
|
@ -20,8 +20,8 @@ import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import static cn.lunadeer.dominion.DominionNode.isInDominion;
|
||||
import static cn.lunadeer.dominion.controllers.Apis.getPlayerCurrentDominion;
|
||||
import static cn.lunadeer.dominion.controllers.Apis.notOwner;
|
||||
import static cn.lunadeer.dominion.utils.ControllerUtils.getPlayerCurrentDominion;
|
||||
import static cn.lunadeer.dominion.utils.ControllerUtils.notOwner;
|
||||
|
||||
public class DominionController {
|
||||
|
||||
|
@ -2,8 +2,9 @@ package cn.lunadeer.dominion.controllers;
|
||||
|
||||
import cn.lunadeer.dominion.dtos.DominionDTO;
|
||||
import cn.lunadeer.dominion.dtos.Flag;
|
||||
import cn.lunadeer.dominion.utils.ControllerUtils;
|
||||
|
||||
import static cn.lunadeer.dominion.controllers.Apis.noAuthToChangeFlags;
|
||||
import static cn.lunadeer.dominion.utils.ControllerUtils.noAuthToChangeFlags;
|
||||
|
||||
public class FlagsController {
|
||||
|
||||
@ -15,7 +16,7 @@ public class FlagsController {
|
||||
* @param value 权限值
|
||||
*/
|
||||
public static void setFlag(AbstractOperator operator, String flag, boolean value) {
|
||||
DominionDTO dominion = Apis.getPlayerCurrentDominion(operator);
|
||||
DominionDTO dominion = ControllerUtils.getPlayerCurrentDominion(operator);
|
||||
if (dominion == null) return;
|
||||
setFlag(operator, flag, value, dominion.getName());
|
||||
operator.setResponse(new AbstractOperator.Result(AbstractOperator.Result.SUCCESS, "设置领地权限 %s 为 %s", flag, value));
|
||||
|
@ -4,8 +4,8 @@ import cn.lunadeer.dominion.dtos.*;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import static cn.lunadeer.dominion.controllers.Apis.noAuthToChangeFlags;
|
||||
import static cn.lunadeer.dominion.controllers.Apis.notOwner;
|
||||
import static cn.lunadeer.dominion.utils.ControllerUtils.noAuthToChangeFlags;
|
||||
import static cn.lunadeer.dominion.utils.ControllerUtils.notOwner;
|
||||
|
||||
public class GroupController {
|
||||
|
||||
|
@ -2,8 +2,8 @@ package cn.lunadeer.dominion.controllers;
|
||||
|
||||
import cn.lunadeer.dominion.dtos.*;
|
||||
|
||||
import static cn.lunadeer.dominion.controllers.Apis.noAuthToChangeFlags;
|
||||
import static cn.lunadeer.dominion.controllers.Apis.notOwner;
|
||||
import static cn.lunadeer.dominion.utils.ControllerUtils.noAuthToChangeFlags;
|
||||
import static cn.lunadeer.dominion.utils.ControllerUtils.notOwner;
|
||||
|
||||
public class MemberController {
|
||||
|
||||
|
@ -13,8 +13,8 @@ import org.bukkit.entity.Player;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
import static cn.lunadeer.dominion.commands.Apis.autoPoints;
|
||||
import static cn.lunadeer.dominion.commands.Apis.playerOnly;
|
||||
import static cn.lunadeer.dominion.utils.CommandUtils.autoPoints;
|
||||
import static cn.lunadeer.dominion.utils.CommandUtils.playerOnly;
|
||||
|
||||
public class CreateDominion {
|
||||
|
||||
|
@ -11,7 +11,7 @@ import cn.lunadeer.minecraftpluginutils.scui.CuiTextInput;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import static cn.lunadeer.dominion.commands.Apis.playerOnly;
|
||||
import static cn.lunadeer.dominion.utils.CommandUtils.playerOnly;
|
||||
|
||||
public class CreateGroup {
|
||||
|
||||
|
@ -8,7 +8,7 @@ import cn.lunadeer.minecraftpluginutils.scui.CuiTextInput;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import static cn.lunadeer.dominion.commands.Apis.playerOnly;
|
||||
import static cn.lunadeer.dominion.utils.CommandUtils.playerOnly;
|
||||
|
||||
public class CreateTemplate {
|
||||
|
||||
|
@ -10,7 +10,7 @@ import cn.lunadeer.minecraftpluginutils.scui.CuiTextInput;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import static cn.lunadeer.dominion.commands.Apis.playerOnly;
|
||||
import static cn.lunadeer.dominion.utils.CommandUtils.playerOnly;
|
||||
|
||||
public class EditJoinMessage {
|
||||
|
||||
|
@ -10,7 +10,7 @@ import cn.lunadeer.minecraftpluginutils.scui.CuiTextInput;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import static cn.lunadeer.dominion.commands.Apis.playerOnly;
|
||||
import static cn.lunadeer.dominion.utils.CommandUtils.playerOnly;
|
||||
|
||||
public class EditLeaveMessage {
|
||||
|
||||
|
@ -14,7 +14,7 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import static cn.lunadeer.dominion.commands.Apis.playerOnly;
|
||||
import static cn.lunadeer.dominion.utils.CommandUtils.playerOnly;
|
||||
|
||||
public class MemberAdd {
|
||||
|
||||
|
@ -8,7 +8,7 @@ import cn.lunadeer.minecraftpluginutils.scui.CuiTextInput;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import static cn.lunadeer.dominion.commands.Apis.playerOnly;
|
||||
import static cn.lunadeer.dominion.utils.CommandUtils.playerOnly;
|
||||
|
||||
public class RenameDominion {
|
||||
|
||||
|
@ -11,7 +11,7 @@ import cn.lunadeer.minecraftpluginutils.scui.CuiTextInput;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import static cn.lunadeer.dominion.commands.Apis.playerOnly;
|
||||
import static cn.lunadeer.dominion.utils.CommandUtils.playerOnly;
|
||||
|
||||
public class RenameGroup {
|
||||
|
||||
|
@ -10,7 +10,7 @@ import cn.lunadeer.minecraftpluginutils.scui.CuiTextInput;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import static cn.lunadeer.dominion.commands.Apis.playerOnly;
|
||||
import static cn.lunadeer.dominion.utils.CommandUtils.playerOnly;
|
||||
|
||||
public class SetMapColor {
|
||||
|
||||
|
@ -10,9 +10,9 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static cn.lunadeer.dominion.commands.Apis.playerOnly;
|
||||
import static cn.lunadeer.dominion.tuis.Apis.getPage;
|
||||
import static cn.lunadeer.dominion.tuis.Apis.notOp;
|
||||
import static cn.lunadeer.dominion.utils.CommandUtils.playerOnly;
|
||||
import static cn.lunadeer.dominion.utils.TuiUtils.getPage;
|
||||
import static cn.lunadeer.dominion.utils.TuiUtils.notOp;
|
||||
import static cn.lunadeer.dominion.tuis.dominion.DominionList.BuildTreeLines;
|
||||
|
||||
public class AllDominion {
|
||||
|
@ -9,7 +9,7 @@ import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import static cn.lunadeer.dominion.commands.Apis.playerOnly;
|
||||
import static cn.lunadeer.dominion.utils.CommandUtils.playerOnly;
|
||||
|
||||
public class Menu {
|
||||
public static void show(CommandSender sender, String[] args) {
|
||||
|
@ -3,6 +3,7 @@ package cn.lunadeer.dominion.tuis;
|
||||
import cn.lunadeer.dominion.Cache;
|
||||
import cn.lunadeer.dominion.Dominion;
|
||||
import cn.lunadeer.dominion.utils.ResMigration;
|
||||
import cn.lunadeer.dominion.utils.TuiUtils;
|
||||
import cn.lunadeer.minecraftpluginutils.Notification;
|
||||
import cn.lunadeer.minecraftpluginutils.stui.ListView;
|
||||
import cn.lunadeer.minecraftpluginutils.stui.components.Button;
|
||||
@ -18,7 +19,7 @@ import org.bukkit.entity.Player;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.lunadeer.dominion.commands.Apis.playerOnly;
|
||||
import static cn.lunadeer.dominion.utils.CommandUtils.playerOnly;
|
||||
|
||||
public class MigrateList {
|
||||
|
||||
@ -31,7 +32,7 @@ public class MigrateList {
|
||||
return;
|
||||
}
|
||||
|
||||
int page = Apis.getPage(args, 1);
|
||||
int page = TuiUtils.getPage(args, 1);
|
||||
|
||||
ListView view = ListView.create(10, "/dominion migrate_list");
|
||||
|
||||
|
@ -11,9 +11,9 @@ import net.kyori.adventure.text.format.TextDecoration;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import static cn.lunadeer.dominion.commands.Apis.playerOnly;
|
||||
import static cn.lunadeer.dominion.tuis.Apis.getPage;
|
||||
import static cn.lunadeer.dominion.tuis.Apis.notOp;
|
||||
import static cn.lunadeer.dominion.utils.CommandUtils.playerOnly;
|
||||
import static cn.lunadeer.dominion.utils.TuiUtils.getPage;
|
||||
import static cn.lunadeer.dominion.utils.TuiUtils.notOp;
|
||||
|
||||
public class SysConfig {
|
||||
public static void show(CommandSender sender, String[] args) {
|
||||
|
@ -11,8 +11,8 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static cn.lunadeer.dominion.commands.Apis.playerOnly;
|
||||
import static cn.lunadeer.dominion.tuis.Apis.getPage;
|
||||
import static cn.lunadeer.dominion.utils.CommandUtils.playerOnly;
|
||||
import static cn.lunadeer.dominion.utils.TuiUtils.getPage;
|
||||
|
||||
public class TitleList {
|
||||
|
||||
|
@ -14,9 +14,9 @@ import org.bukkit.entity.Player;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.lunadeer.dominion.commands.Apis.playerOnly;
|
||||
import static cn.lunadeer.dominion.utils.CommandUtils.playerOnly;
|
||||
import static cn.lunadeer.dominion.commands.Helper.playerAdminDominions;
|
||||
import static cn.lunadeer.dominion.tuis.Apis.getPage;
|
||||
import static cn.lunadeer.dominion.utils.TuiUtils.getPage;
|
||||
|
||||
public class DominionList {
|
||||
public static void show(CommandSender sender, String[] args) {
|
||||
|
@ -11,8 +11,8 @@ import net.kyori.adventure.text.format.TextColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import static cn.lunadeer.dominion.commands.Apis.playerOnly;
|
||||
import static cn.lunadeer.dominion.tuis.Apis.*;
|
||||
import static cn.lunadeer.dominion.utils.CommandUtils.playerOnly;
|
||||
import static cn.lunadeer.dominion.utils.TuiUtils.*;
|
||||
|
||||
public class DominionManage {
|
||||
public static void show(CommandSender sender, String[] args) {
|
||||
|
@ -10,8 +10,8 @@ import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import static cn.lunadeer.dominion.commands.Apis.playerOnly;
|
||||
import static cn.lunadeer.dominion.tuis.Apis.getPage;
|
||||
import static cn.lunadeer.dominion.utils.CommandUtils.playerOnly;
|
||||
import static cn.lunadeer.dominion.utils.TuiUtils.getPage;
|
||||
|
||||
public class EnvSetting {
|
||||
|
||||
|
@ -10,8 +10,8 @@ import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import static cn.lunadeer.dominion.commands.Apis.playerOnly;
|
||||
import static cn.lunadeer.dominion.tuis.Apis.getPage;
|
||||
import static cn.lunadeer.dominion.utils.CommandUtils.playerOnly;
|
||||
import static cn.lunadeer.dominion.utils.TuiUtils.getPage;
|
||||
|
||||
public class GuestSetting {
|
||||
|
||||
|
@ -11,8 +11,8 @@ import cn.lunadeer.minecraftpluginutils.stui.components.Line;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import static cn.lunadeer.dominion.commands.Apis.playerOnly;
|
||||
import static cn.lunadeer.dominion.tuis.Apis.getDominionNameArg_1;
|
||||
import static cn.lunadeer.dominion.utils.CommandUtils.playerOnly;
|
||||
import static cn.lunadeer.dominion.utils.TuiUtils.getDominionNameArg_1;
|
||||
|
||||
public class SizeInfo {
|
||||
public static void show(CommandSender sender, String[] args) {
|
||||
|
@ -4,7 +4,7 @@ import cn.lunadeer.dominion.dtos.DominionDTO;
|
||||
import cn.lunadeer.dominion.dtos.GroupDTO;
|
||||
import cn.lunadeer.dominion.dtos.MemberDTO;
|
||||
import cn.lunadeer.dominion.dtos.PlayerDTO;
|
||||
import cn.lunadeer.dominion.tuis.Apis;
|
||||
import cn.lunadeer.dominion.utils.TuiUtils;
|
||||
import cn.lunadeer.minecraftpluginutils.Notification;
|
||||
import cn.lunadeer.minecraftpluginutils.XLogger;
|
||||
import cn.lunadeer.minecraftpluginutils.stui.ListView;
|
||||
@ -16,8 +16,8 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static cn.lunadeer.dominion.commands.Apis.playerOnly;
|
||||
import static cn.lunadeer.dominion.tuis.Apis.noAuthToManage;
|
||||
import static cn.lunadeer.dominion.utils.CommandUtils.playerOnly;
|
||||
import static cn.lunadeer.dominion.utils.TuiUtils.noAuthToManage;
|
||||
|
||||
public class GroupList {
|
||||
|
||||
@ -42,7 +42,7 @@ public class GroupList {
|
||||
return;
|
||||
}
|
||||
if (noAuthToManage(player, dominion)) return;
|
||||
int page = Apis.getPage(args, 3);
|
||||
int page = TuiUtils.getPage(args, 3);
|
||||
List<GroupDTO> groups = GroupDTO.selectByDominionId(dominion.getId());
|
||||
ListView view = ListView.create(10, "/dominion group list " + dominion.getName());
|
||||
view.title("权限组列表");
|
||||
|
@ -3,7 +3,7 @@ package cn.lunadeer.dominion.tuis.dominion.manage.group;
|
||||
import cn.lunadeer.dominion.dtos.DominionDTO;
|
||||
import cn.lunadeer.dominion.dtos.Flag;
|
||||
import cn.lunadeer.dominion.dtos.GroupDTO;
|
||||
import cn.lunadeer.dominion.tuis.Apis;
|
||||
import cn.lunadeer.dominion.utils.TuiUtils;
|
||||
import cn.lunadeer.minecraftpluginutils.Notification;
|
||||
import cn.lunadeer.minecraftpluginutils.stui.ListView;
|
||||
import cn.lunadeer.minecraftpluginutils.stui.components.Button;
|
||||
@ -12,8 +12,8 @@ import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import static cn.lunadeer.dominion.commands.Apis.playerOnly;
|
||||
import static cn.lunadeer.dominion.tuis.Apis.noAuthToManage;
|
||||
import static cn.lunadeer.dominion.utils.CommandUtils.playerOnly;
|
||||
import static cn.lunadeer.dominion.utils.TuiUtils.noAuthToManage;
|
||||
|
||||
public class GroupSetting {
|
||||
public static void show(CommandSender sender, String dominionName, String groupName) {
|
||||
@ -37,7 +37,7 @@ public class GroupSetting {
|
||||
return;
|
||||
}
|
||||
if (noAuthToManage(player, dominion)) return;
|
||||
int page = Apis.getPage(args, 4);
|
||||
int page = TuiUtils.getPage(args, 4);
|
||||
GroupDTO group = GroupDTO.select(dominion.getId(), args[3]);
|
||||
if (group == null) {
|
||||
Notification.error(sender, "权限组 %s 不存在", args[3]);
|
||||
|
@ -13,9 +13,9 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static cn.lunadeer.dominion.commands.Apis.playerOnly;
|
||||
import static cn.lunadeer.dominion.tuis.Apis.getPage;
|
||||
import static cn.lunadeer.dominion.tuis.Apis.noAuthToManage;
|
||||
import static cn.lunadeer.dominion.utils.CommandUtils.playerOnly;
|
||||
import static cn.lunadeer.dominion.utils.TuiUtils.getPage;
|
||||
import static cn.lunadeer.dominion.utils.TuiUtils.noAuthToManage;
|
||||
|
||||
public class SelectMember {
|
||||
public static void show(CommandSender sender, String[] args) {
|
||||
|
@ -15,10 +15,10 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static cn.lunadeer.dominion.commands.Apis.CommandParser;
|
||||
import static cn.lunadeer.dominion.commands.Apis.playerOnly;
|
||||
import static cn.lunadeer.dominion.tuis.Apis.getPage;
|
||||
import static cn.lunadeer.dominion.tuis.Apis.noAuthToManage;
|
||||
import static cn.lunadeer.dominion.utils.CommandUtils.CommandParser;
|
||||
import static cn.lunadeer.dominion.utils.CommandUtils.playerOnly;
|
||||
import static cn.lunadeer.dominion.utils.TuiUtils.getPage;
|
||||
import static cn.lunadeer.dominion.utils.TuiUtils.noAuthToManage;
|
||||
|
||||
public class MemberList {
|
||||
|
||||
|
@ -12,9 +12,9 @@ import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import static cn.lunadeer.dominion.commands.Apis.playerOnly;
|
||||
import static cn.lunadeer.dominion.tuis.Apis.getPage;
|
||||
import static cn.lunadeer.dominion.tuis.Apis.noAuthToManage;
|
||||
import static cn.lunadeer.dominion.utils.CommandUtils.playerOnly;
|
||||
import static cn.lunadeer.dominion.utils.TuiUtils.getPage;
|
||||
import static cn.lunadeer.dominion.utils.TuiUtils.noAuthToManage;
|
||||
|
||||
public class MemberSetting {
|
||||
public static void show(CommandSender sender, String dominionName, String playerName, Integer page) {
|
||||
|
@ -11,9 +11,9 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static cn.lunadeer.dominion.commands.Apis.CommandParser;
|
||||
import static cn.lunadeer.dominion.commands.Apis.playerOnly;
|
||||
import static cn.lunadeer.dominion.tuis.Apis.getPage;
|
||||
import static cn.lunadeer.dominion.utils.CommandUtils.CommandParser;
|
||||
import static cn.lunadeer.dominion.utils.CommandUtils.playerOnly;
|
||||
import static cn.lunadeer.dominion.utils.TuiUtils.getPage;
|
||||
|
||||
public class SelectPlayer {
|
||||
public static void show(CommandSender sender, String dominionName, Integer page) {
|
||||
|
@ -11,9 +11,9 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static cn.lunadeer.dominion.commands.Apis.CommandParser;
|
||||
import static cn.lunadeer.dominion.commands.Apis.playerOnly;
|
||||
import static cn.lunadeer.dominion.tuis.Apis.getPage;
|
||||
import static cn.lunadeer.dominion.utils.CommandUtils.CommandParser;
|
||||
import static cn.lunadeer.dominion.utils.CommandUtils.playerOnly;
|
||||
import static cn.lunadeer.dominion.utils.TuiUtils.getPage;
|
||||
|
||||
public class SelectTemplate {
|
||||
|
||||
|
@ -9,8 +9,8 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static cn.lunadeer.dominion.commands.Apis.playerOnly;
|
||||
import static cn.lunadeer.dominion.tuis.Apis.getPage;
|
||||
import static cn.lunadeer.dominion.utils.CommandUtils.playerOnly;
|
||||
import static cn.lunadeer.dominion.utils.TuiUtils.getPage;
|
||||
|
||||
public class TemplateList {
|
||||
|
||||
|
@ -10,8 +10,8 @@ import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import static cn.lunadeer.dominion.commands.Apis.playerOnly;
|
||||
import static cn.lunadeer.dominion.tuis.Apis.getPage;
|
||||
import static cn.lunadeer.dominion.utils.CommandUtils.playerOnly;
|
||||
import static cn.lunadeer.dominion.utils.TuiUtils.getPage;
|
||||
|
||||
public class TemplateSetting {
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
package cn.lunadeer.dominion.commands;
|
||||
package cn.lunadeer.dominion.utils;
|
||||
|
||||
import cn.lunadeer.dominion.Dominion;
|
||||
import cn.lunadeer.dominion.dtos.DominionDTO;
|
||||
import cn.lunadeer.minecraftpluginutils.Notification;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -10,7 +9,7 @@ import org.bukkit.entity.Player;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class Apis {
|
||||
public class CommandUtils {
|
||||
public static Player playerOnly(CommandSender sender) {
|
||||
if (!(sender instanceof Player)) {
|
||||
Notification.error(sender, "该命令只能由玩家执行");
|
||||
@ -27,23 +26,6 @@ public class Apis {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void sizeInfo(CommandSender sender, DominionDTO dominionDTO) {
|
||||
Integer x1 = dominionDTO.getX1();
|
||||
Integer y1 = dominionDTO.getY1();
|
||||
Integer z1 = dominionDTO.getZ1();
|
||||
Integer x2 = dominionDTO.getX2();
|
||||
Integer y2 = dominionDTO.getY2();
|
||||
Integer z2 = dominionDTO.getZ2();
|
||||
Notification.info(sender, "领地 %s 的尺寸信息:", dominionDTO.getName());
|
||||
Notification.info(sender, " 大小: %d x %d x %d", x2 - x1, y2 - y1, z2 - z1);
|
||||
Notification.info(sender, " 中心坐标: %d %d %d", x1 + (x2 - x1) / 2, y1 + (y2 - y1) / 2, z1 + (z2 - z1) / 2);
|
||||
Notification.info(sender, " 高度: %d", y2 - y1);
|
||||
Notification.info(sender, " Y坐标范围: %d ~ %d", y1, y2);
|
||||
Notification.info(sender, " 体积: %d", (x2 - x1) * (y2 - y1) * (z2 - z1));
|
||||
Notification.info(sender, " 领地所在世界: %s", dominionDTO.getWorld());
|
||||
Notification.info(sender, " 领地的对角点坐标: x1=%d y1=%d z1=%d, x2=%d y2=%d z2=%d", x1, y1, z1, x2, y2, z2);
|
||||
}
|
||||
|
||||
public static Map<Integer, Location> autoPoints(Player player) {
|
||||
Integer size = Dominion.config.getAutoCreateRadius();
|
||||
Location location = player.getLocation();
|
@ -1,12 +1,13 @@
|
||||
package cn.lunadeer.dominion.controllers;
|
||||
package cn.lunadeer.dominion.utils;
|
||||
|
||||
import cn.lunadeer.dominion.Cache;
|
||||
import cn.lunadeer.dominion.Dominion;
|
||||
import cn.lunadeer.dominion.controllers.AbstractOperator;
|
||||
import cn.lunadeer.dominion.dtos.DominionDTO;
|
||||
import cn.lunadeer.dominion.dtos.MemberDTO;
|
||||
import org.bukkit.Location;
|
||||
|
||||
public class Apis {
|
||||
public class ControllerUtils {
|
||||
|
||||
public static boolean notOwner(AbstractOperator player, DominionDTO dominion) {
|
||||
if (player.isOp() && Dominion.config.getLimitOpBypass()) return false;
|
@ -1,4 +1,4 @@
|
||||
package cn.lunadeer.dominion.events;
|
||||
package cn.lunadeer.dominion.utils;
|
||||
|
||||
import cn.lunadeer.dominion.Cache;
|
||||
import cn.lunadeer.dominion.Dominion;
|
||||
@ -19,7 +19,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class Apis {
|
||||
public class EventUtils {
|
||||
public static boolean canByPass(Player player, DominionDTO dom, MemberDTO prev) {
|
||||
if (player.isOp() && Dominion.config.getLimitOpBypass()) {
|
||||
return true;
|
@ -1,4 +1,4 @@
|
||||
package cn.lunadeer.dominion.tuis;
|
||||
package cn.lunadeer.dominion.utils;
|
||||
|
||||
import cn.lunadeer.dominion.Cache;
|
||||
import cn.lunadeer.dominion.dtos.DominionDTO;
|
||||
@ -10,9 +10,9 @@ import cn.lunadeer.minecraftpluginutils.stui.components.Line;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import static cn.lunadeer.dominion.commands.Apis.playerOnly;
|
||||
import static cn.lunadeer.dominion.utils.CommandUtils.playerOnly;
|
||||
|
||||
public class Apis {
|
||||
public class TuiUtils {
|
||||
|
||||
public static int getPage(String[] args, int pos) {
|
||||
int page = 1;
|
@ -21,7 +21,7 @@ import org.bukkit.event.player.PlayerInteractEvent;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import static cn.lunadeer.dominion.events.Apis.checkFlag;
|
||||
import static cn.lunadeer.dominion.utils.EventUtils.checkFlag;
|
||||
import static org.bukkit.Material.FARMLAND;
|
||||
|
||||
public class EnvironmentEvents implements Listener {
|
||||
|
@ -31,8 +31,8 @@ import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.material.Colorable;
|
||||
import org.spigotmc.event.entity.EntityMountEvent;
|
||||
|
||||
import static cn.lunadeer.dominion.events.Apis.checkFlag;
|
||||
import static cn.lunadeer.dominion.events.Apis.getInvDominion;
|
||||
import static cn.lunadeer.dominion.utils.EventUtils.checkFlag;
|
||||
import static cn.lunadeer.dominion.utils.EventUtils.getInvDominion;
|
||||
|
||||
public class PlayerEvents implements Listener {
|
||||
@EventHandler
|
||||
|
@ -21,7 +21,7 @@ import org.bukkit.event.player.PlayerInteractEvent;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import static cn.lunadeer.dominion.events.Apis.checkFlag;
|
||||
import static cn.lunadeer.dominion.utils.EventUtils.checkFlag;
|
||||
import static org.bukkit.Material.FARMLAND;
|
||||
|
||||
public class EnvironmentEvents implements Listener {
|
||||
|
@ -27,8 +27,8 @@ import org.bukkit.event.vehicle.VehicleDestroyEvent;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.material.Colorable;
|
||||
|
||||
import static cn.lunadeer.dominion.events.Apis.checkFlag;
|
||||
import static cn.lunadeer.dominion.events.Apis.getInvDominion;
|
||||
import static cn.lunadeer.dominion.utils.EventUtils.checkFlag;
|
||||
import static cn.lunadeer.dominion.utils.EventUtils.getInvDominion;
|
||||
|
||||
public class PlayerEvents implements Listener {
|
||||
@EventHandler
|
||||
|
Reference in New Issue
Block a user