-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathLabyrinth.java
More file actions
58 lines (46 loc) · 2.29 KB
/
Labyrinth.java
File metadata and controls
58 lines (46 loc) · 2.29 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
package net.onelitefeather.labyrinth;
import net.onelitefeather.labyrinth.commands.CenterCommand;
import net.onelitefeather.labyrinth.commands.CreateZoneCommand;
import net.onelitefeather.labyrinth.commands.DeleteZoneCommand;
import net.onelitefeather.labyrinth.commands.ToggleMobSpawnCommand;
import net.onelitefeather.labyrinth.commands.SetRadiusCommand;
import net.onelitefeather.labyrinth.listener.MobspawnListener;
import net.onelitefeather.labyrinth.commands.ZoneSuggestions;
import net.onelitefeather.labyrinth.service.api.ValidationService;
import net.onelitefeather.labyrinth.service.impl.ValidationServiceImpl;
import org.bukkit.command.CommandSender;
import org.bukkit.plugin.java.JavaPlugin;
import org.incendo.cloud.annotations.AnnotationParser;
import org.incendo.cloud.bukkit.CloudBukkitCapabilities;
import org.incendo.cloud.execution.ExecutionCoordinator;
import org.incendo.cloud.meta.CommandMeta;
import org.incendo.cloud.paper.LegacyPaperCommandManager;
public class Labyrinth extends JavaPlugin {
private ValidationService validationService;
@Override
public void onLoad() {
this.validationService = new ValidationServiceImpl(this);
}
@Override
public void onEnable() {
saveDefaultConfig();
registerCommands();
registerListeners();
}
public void registerCommands() {
var commandManager = LegacyPaperCommandManager.createNative(this, ExecutionCoordinator.simpleCoordinator());
if (commandManager.hasCapability(CloudBukkitCapabilities.ASYNCHRONOUS_COMPLETION)) {
commandManager.registerAsynchronousCompletions();
}
var annotationParser = new AnnotationParser<>(commandManager, CommandSender.class, parameters -> CommandMeta.empty());
annotationParser.parse(new ZoneSuggestions(this));
annotationParser.parse(new CenterCommand(this, this.validationService));
annotationParser.parse(new SetRadiusCommand(this, this.validationService));
annotationParser.parse(new ToggleMobSpawnCommand(this, this.validationService));
annotationParser.parse(new CreateZoneCommand(this));
annotationParser.parse(new DeleteZoneCommand(this));
}
public void registerListeners() {
getServer().getPluginManager().registerEvents(new MobspawnListener(this), this);
}
}