-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathReloadCommand.java
More file actions
39 lines (32 loc) · 1.36 KB
/
ReloadCommand.java
File metadata and controls
39 lines (32 loc) · 1.36 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
package com.eternalcode.example.command;
import com.eternalcode.example.config.ConfigurationManager;
import com.eternalcode.example.notice.ExampleMultification;
import com.velocitypowered.api.command.CommandSource;
import com.velocitypowered.api.proxy.Player;
import dev.rollczi.litecommands.annotations.command.Command;
import dev.rollczi.litecommands.annotations.context.Context;
import dev.rollczi.litecommands.annotations.execute.Execute;
@Command(name = "reload-config")
public class ReloadCommand {
private final ConfigurationManager configurationManager;
private final ExampleMultification multification;
public ReloadCommand(ConfigurationManager configurationManager, ExampleMultification multification) {
this.configurationManager = configurationManager;
this.multification = multification;
}
@Execute
public void execute(@Context CommandSource sender) {
this.configurationManager.reload();
if (sender instanceof Player player) {
this.multification.create()
.player(player.getUniqueId())
.notice(messagesConfig -> messagesConfig.reloadMessage)
.send();
return;
}
this.multification.create()
.console()
.notice(messagesConfig -> messagesConfig.reloadMessage)
.send();
}
}