This commit is contained in:
parent
7cc9395cbc
commit
1380e7479a
11 changed files with 45 additions and 77 deletions
|
@ -4,6 +4,7 @@ import me.unurled.sacredrealms.sr.SR;
|
|||
import me.unurled.sacredrealms.sr.commands.admin.AttributeCommand;
|
||||
import me.unurled.sacredrealms.sr.commands.player.ResetAdventureCommand;
|
||||
import me.unurled.sacredrealms.sr.managers.Manager;
|
||||
import org.bukkit.command.PluginCommand;
|
||||
|
||||
public class CommandManager extends Manager {
|
||||
|
||||
|
@ -11,10 +12,17 @@ public class CommandManager extends Manager {
|
|||
@Override
|
||||
public void load() {
|
||||
super.load();
|
||||
SR.getInstance().getCommand("attributes").setExecutor(new AttributeCommand());
|
||||
SR.getInstance().getCommand("attributes").setTabCompleter(new AttributeCommand());
|
||||
SR instance = SR.getInstance();
|
||||
PluginCommand attributes = instance.getCommand("attributes");
|
||||
if (attributes != null) {
|
||||
attributes.setExecutor(new AttributeCommand());
|
||||
attributes.setTabCompleter(new AttributeCommand());
|
||||
}
|
||||
|
||||
SR.getInstance().getCommand("resetadventure").setExecutor(new ResetAdventureCommand());
|
||||
SR.getInstance().getCommand("resetadventure").setTabCompleter(new ResetAdventureCommand());
|
||||
PluginCommand resetadventure = instance.getCommand("resetadventure");
|
||||
if (resetadventure != null) {
|
||||
resetadventure.setExecutor(new ResetAdventureCommand());
|
||||
resetadventure.setTabCompleter(new ResetAdventureCommand());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -133,12 +133,19 @@ public class ResetAdventureCommand implements TabExecutor {
|
|||
if (args[0].isBlank()) {
|
||||
return Arrays.stream(Bukkit.getOfflinePlayers())
|
||||
.map(OfflinePlayer::getName)
|
||||
.toList().stream().limit(10).toList();
|
||||
.toList()
|
||||
.stream()
|
||||
.limit(10)
|
||||
.toList();
|
||||
}
|
||||
return Arrays.stream(Bukkit.getOfflinePlayers())
|
||||
.map(OfflinePlayer::getName).filter(Objects::nonNull)
|
||||
.map(OfflinePlayer::getName)
|
||||
.filter(Objects::nonNull)
|
||||
.filter(name -> name.toLowerCase().startsWith(args[0].toLowerCase()))
|
||||
.toList().stream().limit(10).toList();
|
||||
.toList()
|
||||
.stream()
|
||||
.limit(10)
|
||||
.toList();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue