Fix NPE in key configuration, fixed tab completion
Added missing key mapping to prevent NullPointerException when no UUIDs are present in KeyStorage. Also adjusted tab completion logic in Key.java to handle cases with more than one argument.
This commit is contained in:
parent
d43f269c22
commit
5a7b9859cd
|
|
@ -74,7 +74,7 @@ public class Key extends SubCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getTabComplete(CommandSender commandSender, String[] args) {
|
public List<String> getTabComplete(CommandSender commandSender, String[] args) {
|
||||||
if (args.length > 1) {
|
if (args.length > 2) {
|
||||||
return List.of();
|
return List.of();
|
||||||
}
|
}
|
||||||
return Config.KEY.CRATES.keySet().stream().toList();
|
return Config.KEY.CRATES.keySet().stream().toList();
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,7 @@ public class KeyStorage extends AbstractConfig {
|
||||||
ConfigurationSection configurationSection = config.getConfigurationSection(prefix + crate);
|
ConfigurationSection configurationSection = config.getConfigurationSection(prefix + crate);
|
||||||
if (configurationSection == null) {
|
if (configurationSection == null) {
|
||||||
config.logger.info(String.format("No section yet for crate %s", crate));
|
config.logger.info(String.format("No section yet for crate %s", crate));
|
||||||
|
KEYS.put(crate, count);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
List<UUID> uuids = configurationSection.getKeys(false).stream().map(UUID::fromString).toList();
|
List<UUID> uuids = configurationSection.getKeys(false).stream().map(UUID::fromString).toList();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user