22
33import co .aikar .commands .BaseCommand ;
44import co .aikar .commands .CommandHelp ;
5- import co .aikar .commands .annotation .CommandAlias ;
6- import co .aikar .commands .annotation .CommandPermission ;
7- import co .aikar .commands .annotation .Description ;
8- import co .aikar .commands .annotation .HelpCommand ;
9- import co .aikar .commands .annotation .Subcommand ;
5+ import co .aikar .commands .annotation .*;
106import co .aikar .commands .bukkit .contexts .OnlinePlayer ;
117import com .epicplayera10 .joinguard .JoinGuard ;
128import com .epicplayera10 .joinguard .utils .ChatUtils ;
2218import java .util .Base64 ;
2319import java .util .concurrent .CompletableFuture ;
2420
25- @ CommandAlias ("joinguard" )
21+ @ CommandAlias ("joinguard|jg " )
2622@ CommandPermission ("joinguard.admin" )
2723public class JoinGuardCommand extends BaseCommand {
2824 @ HelpCommand
@@ -39,24 +35,40 @@ public void reload(CommandSender sender) {
3935 }
4036
4137 @ Subcommand ("whitelist add" )
38+ @ Syntax ("<gracz>" )
39+ @ CommandCompletion ("@not_whitelisted" )
4240 @ Description ("Dodaj gracza do whitelisty" )
4341 public void whitelistAdd (CommandSender sender , String playerName ) {
42+ if (JoinGuard .instance ().pluginConfiguration ().whitelistedNicks .contains (playerName )){
43+ sender .sendMessage (ChatUtils .colorize ("&cGracz jest już na whitelistcie" ));
44+ return ;
45+ }
4446 JoinGuard .instance ().pluginConfiguration ().whitelistedNicks .add (playerName );
4547 JoinGuard .instance ().pluginConfiguration ().save ();
46- sender .sendMessage ("Player added to whitelist! " );
48+ sender .sendMessage ("Dodano " + playerName + " do whitelisty " );
4749 }
4850
4951 @ Subcommand ("whitelist remove" )
52+ @ Syntax ("<gracz>" )
53+ @ CommandCompletion ("@whitelist" )
5054 @ Description ("Usuń gracza z whitelisty" )
5155 public void whitelistRemove (CommandSender sender , String playerName ) {
56+ if (!JoinGuard .instance ().pluginConfiguration ().whitelistedNicks .contains (playerName )){
57+ sender .sendMessage (ChatUtils .colorize ("&cGracza nie ma na whitelistcie" ));
58+ return ;
59+ }
5260 JoinGuard .instance ().pluginConfiguration ().whitelistedNicks .remove (playerName );
5361 JoinGuard .instance ().pluginConfiguration ().save ();
54- sender .sendMessage ("Player removed from whitelist! " );
62+ sender .sendMessage ("Usunięto " + playerName + " z whitelisty " );
5563 }
5664
5765 @ Subcommand ("whitelist list" )
5866 @ Description ("Wyświetl listę graczy na whitelistcie" )
5967 public void whitelistList (CommandSender sender ) {
68+ if (JoinGuard .instance ().pluginConfiguration ().whitelistedNicks .isEmpty ()){
69+ sender .sendMessage ("Na whitelistcie nie ma żadnych graczy" );
70+ return ;
71+ }
6072 StringBuilder builder = new StringBuilder ();
6173 boolean first = true ;
6274 for (String nick : JoinGuard .instance ().pluginConfiguration ().whitelistedNicks ) {
@@ -66,7 +78,7 @@ public void whitelistList(CommandSender sender) {
6678 builder .append (nick );
6779 first = false ;
6880 }
69- sender .sendMessage ("Whitelisted players : " + builder );
81+ sender .sendMessage ("Gracze na whitelistcie : " + builder );
7082 }
7183
7284 @ Subcommand ("login" )
@@ -94,6 +106,7 @@ public void login(CommandSender sender) {
94106 }
95107
96108 @ Subcommand ("report" )
109+ @ Syntax ("<gracz>" )
97110 @ Description ("Zgłoś gracza" )
98111 public void reportPlayer (Player player , OnlinePlayer reportedPlayer ) {
99112 CompletableFuture .runAsync (() -> {
0 commit comments