Skip to content

Commit b70ea1d

Browse files
author
damt
committed
Merge remote-tracking branch 'origin/master'
2 parents 086ce74 + adf1095 commit b70ea1d

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

README.md

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ Annotation/Reflection Based Command API that just does what you want it to do wi
1616
<dependency>
1717
<groupId>com.github.therealdamt</groupId>
1818
<artifactId>commandapi</artifactId>
19-
<version>1.3.0</version>
19+
<version>aa9298fe3e</version>
20+
<scope>provided</scope>
2021
</dependency>
2122
```
2223

@@ -31,7 +32,7 @@ Annotation/Reflection Based Command API that just does what you want it to do wi
3132

3233
```gradle
3334
dependencies {
34-
implementation 'com.github.therealdamt:commandapi:1.1.0'
35+
implementation 'com.github.therealdamt:commandapi:aa9298fe3e'
3536
}
3637
```
3738

@@ -74,10 +75,12 @@ public class ItemStackProvider implements CommandProvider<ItemStack> {
7475
@Override
7576
public ItemStack provide(String s) throws CommandProviderNullException {
7677

77-
if (!s.equalsIgnoreCase("itemStack"))
78-
throw new CommandProviderNullException(ChatColor.RED + "You need to type 'itemStack' to get this provider!");
78+
Material material = Material.getMaterial(s.toUpperCase());
7979

80-
return new ItemStack(Material.DIRT);
80+
if (material == null)
81+
throw new CommandProviderNullException(ChatColor.RED + "It seems like you did not provide a valid material.");
82+
83+
return new ItemStack(material);
8184
}
8285

8386
}
@@ -90,7 +93,10 @@ public class HelpService implements HelpCommandService {
9093

9194
@Override
9295
public List<String> get(Command command, List<Command> subCommands) {
93-
return subCommands.stream().map(command1 -> command.getUsage() + ", ").collect(Collectors.toList());
96+
return subCommands
97+
.stream()
98+
.map(command1 -> command.getUsage() + ", ")
99+
.collect(Collectors.toList());
94100
}
95101

96102
}
@@ -103,7 +109,10 @@ public class TabCompleter implements TabComplete {
103109

104110
@Override
105111
public List<String> get(Command command, List<Command> subCommands, String[] args) {
106-
return subCommands.stream().map(subCommand -> subCommand.getName() + "\n").collect(Collectors.toList());
112+
return subCommands
113+
.stream()
114+
.map(subCommand -> subCommand.getName() + "\n")
115+
.collect(Collectors.toList());
107116
}
108117

109118
}

0 commit comments

Comments
 (0)