new-1.1
This commit is contained in:
parent
ebd5431294
commit
ddc438b2d3
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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()) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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> {
|
||||||
|
|
|
@ -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> {
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user