/
BukkitCommandRegistry.java
184 lines (171 loc) · 7.87 KB
/
BukkitCommandRegistry.java
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
package com.denizenscript.denizen.scripts.commands;
import com.denizenscript.denizen.nms.NMSHandler;
import com.denizenscript.denizen.nms.NMSVersion;
import com.denizenscript.denizen.scripts.commands.core.*;
import com.denizenscript.denizen.scripts.commands.entity.*;
import com.denizenscript.denizen.scripts.commands.item.*;
import com.denizenscript.denizen.scripts.commands.npc.*;
import com.denizenscript.denizen.scripts.commands.player.*;
import com.denizenscript.denizen.scripts.commands.server.*;
import com.denizenscript.denizen.scripts.commands.world.*;
import com.denizenscript.denizen.utilities.debugging.Debug;
import com.denizenscript.denizen.utilities.depends.Depends;
import com.denizenscript.denizencore.exceptions.InvalidArgumentsException;
import com.denizenscript.denizencore.scripts.ScriptEntry;
import com.denizenscript.denizencore.scripts.commands.AbstractCommand;
import com.denizenscript.denizencore.scripts.commands.CommandRegistry;
public class BukkitCommandRegistry extends CommandRegistry {
public static class AutoNoCitizensCommand extends AbstractCommand {
public static void registerMany(String... names) {
for (String name : names) {
registerFor(name);
}
}
public static void registerFor(String name) {
AutoNoCitizensCommand cmd = new AutoNoCitizensCommand();
cmd.name = name;
cmd.syntax = "(Citizens Required)";
}
public String name;
@Override
public void parseArgs(ScriptEntry scriptEntry) throws InvalidArgumentsException {
}
@Override
public void execute(ScriptEntry scriptEntry) {
Debug.echoError("The command '" + name + "' is only available when Citizens is on the server.");
}
}
public void registerCommands() {
registerCoreCommands();
//core
registerCommand(CooldownCommand.class);
registerCommand(FlagCommand.class);
registerCommand(NoteCommand.class);
registerCommand(ResetCommand.class);
registerCommand(ZapCommand.class);
// entity
registerCommand(AgeCommand.class);
if (Depends.citizens != null) {
registerCommand(AnimateCommand.class);
}
registerCommand(AttachCommand.class);
registerCommand(AttackCommand.class);
registerCommand(BurnCommand.class);
registerCommand(CastCommand.class);
registerCommand(EquipCommand.class);
registerCommand(FeedCommand.class);
registerCommand(FlyCommand.class);
registerCommand(FollowCommand.class);
registerCommand(HeadCommand.class);
registerCommand(HealCommand.class);
registerCommand(HealthCommand.class);
registerCommand(HurtCommand.class);
registerCommand(InvisibleCommand.class);
registerCommand(LeashCommand.class);
registerCommand(LookCommand.class);
registerCommand(MountCommand.class);
registerCommand(PushCommand.class);
registerCommand(RemoveCommand.class);
registerCommand(RotateCommand.class);
registerCommand(ShootCommand.class);
registerCommand(SpawnCommand.class);
registerCommand(TeleportCommand.class);
registerCommand(WalkCommand.class);
// item
registerCommand(DisplayItemCommand.class);
registerCommand(FakeItemCommand.class);
registerCommand(GiveCommand.class);
registerCommand(InventoryCommand.class);
registerCommand(MapCommand.class);
registerCommand(NBTCommand.class);
registerCommand(ScribeCommand.class);
registerCommand(TakeCommand.class);
// npc
if (Depends.citizens != null) {
registerCommand(ActionCommand.class);
registerCommand(AnchorCommand.class);
registerCommand(AssignmentCommand.class);
registerCommand(BreakCommand.class);
registerCommand(CreateCommand.class);
registerCommand(DespawnCommand.class);
registerCommand(DisengageCommand.class);
registerCommand(EngageCommand.class);
registerCommand(FishCommand.class);
registerCommand(LookcloseCommand.class);
registerCommand(PauseCommand.class);
registerCommand(PauseCommand.ResumeCommand.class);
registerCommand(PoseCommand.class);
registerCommand(PushableCommand.class);
registerCommand(RenameCommand.class);
registerCommand(SitCommand.class);
registerCommand(SleepCommand.class);
registerCommand(StandCommand.class);
registerCommand(TraitCommand.class);
registerCommand(TriggerCommand.class);
registerCommand(VulnerableCommand.class);
}
// player
registerCommand(ActionBarCommand.class);
registerCommand(AdvancementCommand.class);
registerCommand(BlockCrackCommand.class);
if (Depends.citizens != null) {
registerCommand(ChatCommand.class);
}
registerCommand(CompassCommand.class);
if (NMSHandler.getVersion().isAtLeast(NMSVersion.v1_15)) {
registerCommand(DisguiseCommand.class);
}
registerCommand(ExperienceCommand.class);
if (NMSHandler.getVersion().isAtLeast(NMSVersion.v1_15)) {
registerCommand(FakeSpawnCommand.class);
}
registerCommand(GlowCommand.class);
registerCommand(GroupCommand.class);
registerCommand(ItemCooldownCommand.class);
registerCommand(KickCommand.class);
registerCommand(MoneyCommand.class);
registerCommand(NarrateCommand.class);
registerCommand(OpenTradesCommand.class);
registerCommand(OxygenCommand.class);
registerCommand(PermissionCommand.class);
registerCommand(ShowFakeCommand.class);
registerCommand(SidebarCommand.class);
registerCommand(StatisticCommand.class);
registerCommand(TeamCommand.class);
registerCommand(TitleCommand.class);
registerCommand(ToastCommand.class);
// server
registerCommand(AnnounceCommand.class);
registerCommand(BanCommand.class);
registerCommand(BossBarCommand.class);
registerCommand(ExecuteCommand.class);
registerCommand(ScoreboardCommand.class);
// world
registerCommand(AdjustBlockCommand.class);
registerCommand(AnimateChestCommand.class);
registerCommand(ChunkLoadCommand.class);
registerCommand(CopyBlockCommand.class);
registerCommand(CreateWorldCommand.class);
registerCommand(DropCommand.class);
registerCommand(ExplodeCommand.class);
registerCommand(FireworkCommand.class);
registerCommand(GameRuleCommand.class);
registerCommand(LightCommand.class);
registerCommand(MidiCommand.class);
registerCommand(ModifyBlockCommand.class);
registerCommand(PlayEffectCommand.class);
registerCommand(PlaySoundCommand.class);
registerCommand(SchematicCommand.class);
registerCommand(SignCommand.class);
registerCommand(StrikeCommand.class);
registerCommand(SwitchCommand.class);
registerCommand(TimeCommand.class);
registerCommand(WeatherCommand.class);
registerCommand(WorldBorderCommand.class);
if (Depends.citizens == null) {
AutoNoCitizensCommand.registerMany("ACTION", "ANCHOR", "ANIMATE", "ASSIGNMENT", "BREAK", "CHAT", "CREATE", "DESPAWN",
"DISENGAGE", "ENGAGE", "FISH", "LOOKCLOSE", "PAUSE", "RESUME", "POSE", "PUSHABLE", "RENAME", "SIT", "STAND", "TRAIT", "TRIGGER", "VULNERABLE");
}
Debug.echoApproval("Loaded core commands: " + instances.keySet().toString());
}
}