mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-20 03:35:51 +00:00
[CI skip] A little bit refactoring
This commit is contained in:
parent
f9987d1308
commit
ccc1048eed
@ -93,6 +93,16 @@ public class SlimefunRegistry {
|
||||
public List<SlimefunItem> getEnabledSlimefunItems() {
|
||||
return enabledItems;
|
||||
}
|
||||
|
||||
public List<String> getEnabledSlimefunItemIds() {
|
||||
List<String> list = new ArrayList<>(enabledItems.size());
|
||||
|
||||
for (SlimefunItem item : enabledItems) {
|
||||
list.add(item.getID());
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public int countVanillaItems() {
|
||||
return (int) getEnabledSlimefunItems().stream().filter(item -> !item.isAddonItem()).count();
|
||||
|
@ -3,14 +3,13 @@ package io.github.thebusybiscuit.slimefun4.core.commands;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Research;
|
||||
import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabCompleter;
|
||||
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Research;
|
||||
|
||||
public class SlimefunTabCompleter implements TabCompleter {
|
||||
|
||||
private final SlimefunCommand command;
|
||||
@ -26,7 +25,7 @@ public class SlimefunTabCompleter implements TabCompleter {
|
||||
}
|
||||
else if (args.length == 3) {
|
||||
if (args[0].equalsIgnoreCase("give")) {
|
||||
return createReturnList(Slimefun.listIDs(), args[2]);
|
||||
return createReturnList(SlimefunPlugin.getRegistry().getEnabledSlimefunItemIds(), args[2]);
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("research")) {
|
||||
List<String> researches = new ArrayList<>();
|
||||
|
@ -11,6 +11,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
import io.github.thebusybiscuit.cscorelib2.config.Config;
|
||||
import io.github.thebusybiscuit.slimefun4.core.SlimefunRegistry;
|
||||
import io.github.thebusybiscuit.slimefun4.core.services.LocalizationService;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.GPS.GPSNetwork;
|
||||
@ -248,6 +249,8 @@ public final class Slimefun {
|
||||
/**
|
||||
* Lists all the IDs of the enabled items.
|
||||
*
|
||||
* @deprecated Use {@link SlimefunRegistry#getEnabledSlimefunItemIds()}
|
||||
*
|
||||
* @return the list of all the IDs of the enabled items.
|
||||
*/
|
||||
@Deprecated
|
||||
|
Loading…
Reference in New Issue
Block a user