style: 代码结构优化

This commit is contained in:
2023-04-27 07:40:47 +08:00
parent 71254f1f46
commit 9bb6fefa2b
10 changed files with 84 additions and 66 deletions

View File

@@ -12,7 +12,7 @@ import cn.hamster3.mc.plugin.core.bukkit.page.listener.PageListener;
import cn.hamster3.mc.plugin.core.bukkit.util.ItemStackAdapter;
import cn.hamster3.mc.plugin.core.common.constant.CoreConstantObjects;
import cn.hamster3.mc.plugin.core.common.data.DisplayMessage;
import cn.hamster3.mc.plugin.core.common.util.MessageTypeAdapter;
import cn.hamster3.mc.plugin.core.common.misc.MessageTypeAdapter;
import com.google.gson.GsonBuilder;
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
import org.bukkit.Bukkit;

View File

@@ -44,10 +44,11 @@ public abstract class ParentCommand extends ChildCommand {
@NotNull
@Override
public String getUsage() {
if (getParent() == null) {
ParentCommand parent = getParent();
if (parent == null) {
return "/" + name;
}
return getParent().getUsage() + " " + name;
return parent.getUsage() + " " + name;
}
@Override

View File

@@ -3,7 +3,7 @@ package cn.hamster3.mc.plugin.core.bukkit.command.lore;
import cn.hamster3.mc.plugin.core.bukkit.HamsterCorePlugin;
import cn.hamster3.mc.plugin.core.bukkit.command.ParentCommand;
import cn.hamster3.mc.plugin.core.bukkit.command.lore.sub.*;
import cn.hamster3.mc.plugin.core.common.util.CommonUtils;
import cn.hamster3.mc.plugin.core.common.util.CoreUtils;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.plugin.java.JavaPlugin;
@@ -30,7 +30,7 @@ public final class ParentLoreCommand extends ParentCommand {
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
CommonUtils.replaceColorCode(args);
CoreUtils.replaceColorCode(args);
return super.onCommand(sender, command, label, args);
}
}