1
|
|
|
/* |
2
|
|
|
* This file is part of Araknemu. |
3
|
|
|
* |
4
|
|
|
* Araknemu is free software: you can redistribute it and/or modify |
5
|
|
|
* it under the terms of the GNU Lesser General Public License as published by |
6
|
|
|
* the Free Software Foundation, either version 3 of the License, or |
7
|
|
|
* (at your option) any later version. |
8
|
|
|
* |
9
|
|
|
* Araknemu is distributed in the hope that it will be useful, |
10
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
11
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12
|
|
|
* GNU Lesser General Public License for more details. |
13
|
|
|
* |
14
|
|
|
* You should have received a copy of the GNU Lesser General Public License |
15
|
|
|
* along with Araknemu. If not, see <https://www.gnu.org/licenses/>. |
16
|
|
|
* |
17
|
|
|
* Copyright (c) 2017-2021 Vincent Quatrevieux |
18
|
|
|
*/ |
19
|
|
|
|
20
|
|
|
package fr.quatrevieux.araknemu.game.admin.player; |
21
|
|
|
|
22
|
|
|
import fr.quatrevieux.araknemu.game.admin.AbstractMessageCommand; |
23
|
|
|
import fr.quatrevieux.araknemu.game.admin.AdminPerformer; |
24
|
|
|
import fr.quatrevieux.araknemu.game.admin.help.CommandHelp; |
25
|
|
|
import fr.quatrevieux.araknemu.game.player.GamePlayer; |
26
|
|
|
import fr.quatrevieux.araknemu.network.game.out.chat.ServerMessage; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* Command for send a server message to a player |
30
|
|
|
*/ |
31
|
|
|
public final class Message extends AbstractMessageCommand { |
32
|
|
|
private final GamePlayer player; |
33
|
|
|
|
34
|
1 |
|
public Message(GamePlayer player) { |
35
|
1 |
|
this.player = player; |
36
|
1 |
|
} |
37
|
|
|
|
38
|
|
|
@Override |
39
|
|
|
protected void configureHelp(CommandHelp.Builder builder) { |
40
|
1 |
|
builder |
41
|
1 |
|
.description("Send a message to all connected players") |
42
|
1 |
|
.synopsis("@[player] msg [options] MESSAGE") |
43
|
|
|
|
44
|
1 |
|
.example("@John msg Hello World !", "Send message \"Hello World\" to John") |
45
|
1 |
|
.example("@John msg --color red My import message", "Send a message in red") |
46
|
1 |
|
.example("@John msg --color CD5C5C My message", "Send a message in custom color") |
47
|
1 |
|
.example("@John msg --color blue **Note:** go to link : [My link](https://my-site.com/my-page)", "Send a message using markdown") |
48
|
|
|
; |
49
|
1 |
|
} |
50
|
|
|
|
51
|
|
|
@Override |
52
|
|
|
protected void send(AdminPerformer performer, ServerMessage packet) { |
53
|
1 |
|
performer.success("Sending message to {}", player.name()); |
54
|
1 |
|
player.send(packet); |
55
|
1 |
|
} |
56
|
|
|
} |
57
|
|
|
|