This commit is contained in:
YuTian 2025-01-28 23:47:37 +08:00
parent ebd5431294
commit ddc438b2d3
8 changed files with 8 additions and 18 deletions

View File

@ -54,7 +54,7 @@ public class CommandHandler implements CommandExecutor, TabCompleter {
.filter(entry -> entry.getName().equalsIgnoreCase(currentArg)) .filter(entry -> entry.getName().equalsIgnoreCase(currentArg))
.findFirst(); .findFirst();
if (!optionalEntry.isPresent()) { if (optionalEntry.isEmpty()) {
sender.sendMessage(Lang.get("command.unknown-arg", index + 1, currentArg)); sender.sendMessage(Lang.get("command.unknown-arg", index + 1, currentArg));
return; return;
} }
@ -164,7 +164,7 @@ public class CommandHandler implements CommandExecutor, TabCompleter {
CommandEntity commandEntity = entityOptional.get(); CommandEntity commandEntity = entityOptional.get();
List<CommandEntry> entries = commandEntity.getChildrens(); List<CommandEntry> entries = commandEntity.getChildrens();
if (entries.size() == 0) { if (entries.isEmpty()) {
return Collections.emptyList(); return Collections.emptyList();
} }

View File

@ -80,10 +80,9 @@ public class CommandHelp {
private StringBuilder getCommandInfo(CommandEntity command, String commandAlias) { private StringBuilder getCommandInfo(CommandEntity command, String commandAlias) {
StringBuilder stringBuilder = new StringBuilder("§6/"+ commandAlias +" "+ command.getCommand()); StringBuilder stringBuilder = new StringBuilder("§6/"+ commandAlias +" "+ command.getCommand());
stringBuilder.append("§f"); stringBuilder.append("§f");
if (command.getChildrens().size() > 0) { if (!command.getChildrens().isEmpty()) {
if (!(command.getChildrens().size() == 1 && command.getChildrens().get(0).isNodal())) { if (!(command.getChildrens().size() == 1 && command.getChildrens().get(0).isNodal())) {
for (CommandEntry child : command.getChildrens()) { for (CommandEntry child : command.getChildrens()) {
} }
} }
} }

View File

@ -87,9 +87,7 @@ public class TagStatItem {
@Override @Override
public TagStatItem clone() { public TagStatItem clone() {
TagStatItem tagStatItem = new TagStatItem(itemStack.clone()); TagStatItem tagStatItem = new TagStatItem(itemStack.clone());
Iterator iterator = this.stats.keySet().iterator(); for (ItemStat itemStat : this.stats.keySet()) {
while(iterator.hasNext()) {
ItemStat itemStat = (ItemStat) iterator.next();
tagStatItem.stats.put(itemStat, this.stats.get(itemStat)); tagStatItem.stats.put(itemStat, this.stats.get(itemStat));
} }
return tagStatItem; return tagStatItem;

View File

@ -2,6 +2,7 @@ package com.io.yutian.elementoriginlib.item;
import com.io.yutian.elementoriginlib.tag.ItemProxy; import com.io.yutian.elementoriginlib.tag.ItemProxy;
import com.io.yutian.elementoriginlib.tag.TagCompound; import com.io.yutian.elementoriginlib.tag.TagCompound;
import net.kyori.adventure.text.Component;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.ItemMeta;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -46,10 +47,10 @@ public class TagStatItemStackBuilder {
itemStack = itemProxy.getItemStack(); itemStack = itemProxy.getItemStack();
itemMeta = itemStack.getItemMeta(); itemMeta = itemStack.getItemMeta();
tagStatItem.getStats().forEach((stat, statData) -> stat.applyMeta(this, statData)); tagStatItem.getStats().forEach((stat, statData) -> stat.applyMeta(this, statData));
itemStack.setItemMeta(itemMeta); List<Component> lores = itemMeta.hasLore() ? itemMeta.lore() : new ArrayList<>();
List<String> lores = itemMeta.hasLore() ? itemMeta.getLore() : new ArrayList<>();
tagStatItem.getStats().forEach((stat, statData) -> stat.whenApplyLore(this, statData, lores)); tagStatItem.getStats().forEach((stat, statData) -> stat.whenApplyLore(this, statData, lores));
itemStack.setLore(lores); itemMeta.lore(lores);
itemStack.setItemMeta(itemMeta);
} }
@NotNull @NotNull

View File

@ -1,6 +1,5 @@
package com.io.yutian.elementoriginlib.item.stat.data; package com.io.yutian.elementoriginlib.item.stat.data;
import com.io.yutian.elementoriginlib.exception.itemstat.ItemStatDataLoadException;
import com.io.yutian.elementoriginlib.item.stat.Mergeable; import com.io.yutian.elementoriginlib.item.stat.Mergeable;
import com.io.yutian.elementoriginlib.item.stat.StatData; import com.io.yutian.elementoriginlib.item.stat.StatData;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

View File

@ -1,7 +1,5 @@
package com.io.yutian.elementoriginlib.item.stat.data; package com.io.yutian.elementoriginlib.item.stat.data;
import com.io.yutian.elementoriginlib.item.stat.StatData;
import java.util.List; import java.util.List;
public class EnumListData<E extends Enum> extends ListData<E> { public class EnumListData<E extends Enum> extends ListData<E> {

View File

@ -1,9 +1,5 @@
package com.io.yutian.elementoriginlib.item.stat.data; package com.io.yutian.elementoriginlib.item.stat.data;
import com.io.yutian.elementoriginlib.item.stat.Mergeable;
import com.io.yutian.elementoriginlib.item.stat.StatData;
import org.jetbrains.annotations.NotNull;
import java.util.List; import java.util.List;
public class StringListData extends ListData<String> { public class StringListData extends ListData<String> {

View File

@ -3,7 +3,6 @@ package com.io.yutian.elementoriginlib.manager;
import com.io.yutian.elementoriginlib.command.SimpleCommandManager; import com.io.yutian.elementoriginlib.command.SimpleCommandManager;
import com.io.yutian.elementoriginlib.command.list.CommandHelp; import com.io.yutian.elementoriginlib.command.list.CommandHelp;
import com.io.yutian.elementoriginlib.command.list.CommandReload; import com.io.yutian.elementoriginlib.command.list.CommandReload;
import org.bukkit.plugin.Plugin;
public class CommandManager extends SimpleCommandManager { public class CommandManager extends SimpleCommandManager {