-
-
Notifications
You must be signed in to change notification settings - Fork 74
Expand file tree
/
Copy pathHordeCommand2.java
More file actions
152 lines (116 loc) · 4.02 KB
/
HordeCommand2.java
File metadata and controls
152 lines (116 loc) · 4.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
import java.util.function.Supplier;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import dev.jorel.commandapi.CommandAPICommand;
import dev.jorel.commandapi.annotations.annotations.ArgumentParser;
import dev.jorel.commandapi.annotations.annotations.Command;
import dev.jorel.commandapi.annotations.annotations.Permission;
import dev.jorel.commandapi.annotations.annotations.Subcommand;
import dev.jorel.commandapi.annotations.annotations.Suggestion;
import dev.jorel.commandapi.annotations.annotations.Suggests;
import dev.jorel.commandapi.annotations.arguments.ACustomArgument;
import dev.jorel.commandapi.annotations.arguments.AIntegerArgument;
import dev.jorel.commandapi.annotations.arguments.AStringArgument;
import dev.jorel.commandapi.arguments.ArgumentSuggestions;
import dev.jorel.commandapi.arguments.CustomArgument.CustomArgumentException;
import dev.jorel.commandapi.arguments.CustomArgument.CustomArgumentInfo;
import dev.jorel.commandapi.arguments.CustomArgument.CustomArgumentInfoParser;
import dev.jorel.commandapi.arguments.IntegerArgument;
import dev.jorel.commandapi.arguments.MultiLiteralArgument;
import dev.jorel.commandapi.arguments.SafeSuggestions;
import dev.jorel.commandapi.arguments.StringArgument;
@Command("horde")
public class HordeCommand2 {
final int val;
// Some constructor
public HordeCommand2(int val) {
this.val = val;
}
@AStringArgument
String hiiiiii;
@AIntegerArgument
int byeeeeee;
@Subcommand("hazard")
class HazardCommand {
@Subcommand("create")
class CreateCommand {
@Subcommand("fire")
public void fire(CommandSender executor, @AStringArgument String name) {
}
}
@Subcommand("modify")
class ModifyCommand {
@Permission("hello")
@Suggests(HazardSuggestions.class)
@AStringArgument
String name;
// horde hazard modify <name> area <size>
@Subcommand("area")
public void area(Player player, @AIntegerArgument int size) {
}
// horde hazard modify <name> area <size>
@Permission("hoard.hazard.modify.area")
@Subcommand("area")
public void area(CommandSender sender, @AIntegerArgument int size) {
}
// TODO: This should fail because String is not an
// @Subcommand("area")
// public void area2(CommandSender sender, @AIntegerArgument String size) {
// }
@Suggestion
class HazardSuggestions implements Supplier<ArgumentSuggestions> {
@Override
public ArgumentSuggestions get() {
return ArgumentSuggestions.strings("fire", "water", "poison");
}
}
@Suggestion
class LocationSuggestions implements Supplier<SafeSuggestions<Location>> {
@Override
public SafeSuggestions<Location> get() {
return SafeSuggestions.suggest(new Location[0]);
}
}
}
@Subcommand("toggle")
public void toggle(CommandSender sender) {
}
}
@Suggestion
class EnableSuggestions implements Supplier<ArgumentSuggestions> {
@Override
public ArgumentSuggestions get() {
return ArgumentSuggestions.strings("fire", "water", "poison");
}
}
@Suggestion
class LocationSuggestions implements Supplier<SafeSuggestions<Location>> {
@Override
public SafeSuggestions<Location> get() {
return SafeSuggestions.suggest(new Location[0]);
}
}
@Subcommand("enable")
public void enable(Player sender) {
}
@Subcommand("disable")
public void disable(CommandSender sender) {
}
// TODO: When testing, try moving this to its own separate .java file and see if that links properly
@ArgumentParser
class WorldArgument implements CustomArgumentInfoParser<World, String> {
@Override
public World apply(CustomArgumentInfo<String> info) throws CustomArgumentException {
// TODO Auto-generated method stub
return null;
}
}
// TODO: For both custom arguments and suggestions, we should have a check to see if there are
// any unused @ArgumentParser or @Suggestion classes
// @Subcommand("custom")
// public void custom(CommandSender sender, @ACustomArgument(WorldArgument.class) World world) {
//
// }
}