Skip to content

Commit adf1095

Browse files
authored
Update of ReadME by steamworks gang
Update README.md
2 parents 246bebb + 182d0d3 commit adf1095

File tree

1 file changed

+14
-18
lines changed

1 file changed

+14
-18
lines changed

README.md

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -70,27 +70,17 @@ public class ItemStackCommand {
7070
* Example provider
7171

7272
```java
73-
public class PlayerCommandProvider implements CommandProvider<Player> {
74-
75-
private final JavaPlugin javaPlugin;
76-
77-
public PlayerCommandProvider(JavaPlugin javaPlugin) {
78-
this.javaPlugin = javaPlugin;
79-
}
73+
public class ItemStackProvider implements CommandProvider<ItemStack> {
8074

8175
@Override
82-
public Player provide(String s) throws CommandProviderNullException {
83-
final Player player = javaPlugin.getServer().getPlayer(s);
76+
public ItemStack provide(String s) throws CommandProviderNullException {
8477

85-
if (player == null)
86-
throw new CommandProviderNullException(ChatColor.RED + "The player you specified is not online or does not exist!");
78+
Material material = Material.getMaterial(s.toUpperCase());
8779

88-
return player;
89-
}
80+
if (material == null)
81+
throw new CommandProviderNullException(ChatColor.RED + "It seems like you did not provide a valid material.");
9082

91-
@Override
92-
public List<String> suggestions(CommandParameter commandParameter) {
93-
return javaPlugin.getServer().getOnlinePlayers().stream().map(HumanEntity::getName).collect(Collectors.toList());
83+
return new ItemStack(material);
9484
}
9585

9686
}
@@ -103,7 +93,10 @@ public class HelpService implements HelpCommandService {
10393

10494
@Override
10595
public List<String> get(Command command, List<Command> subCommands) {
106-
return subCommands.stream().map(command1 -> command.getUsage() + ", ").collect(Collectors.toList());
96+
return subCommands
97+
.stream()
98+
.map(command1 -> command.getUsage() + ", ")
99+
.collect(Collectors.toList());
107100
}
108101

109102
}
@@ -116,7 +109,10 @@ public class TabCompleter implements TabComplete {
116109

117110
@Override
118111
public List<String> get(Command command, List<Command> subCommands, String[] args) {
119-
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());
120116
}
121117

122118
}

0 commit comments

Comments
 (0)