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
| package ircBot.commands.admin;
import java.util.ArrayList;
import ircBot.KBot;
import ircBot.commands.admin.*;
public class admin {
private static ArrayList<String> users = new ArrayList();
public static void execute(KBot k, String sender, String login,
String hostname, String[] command) {
String pass = "***";
// Commande D'authentification
if (users.contains(sender)) {
// Commande d'arret du bot
if (command[1].equalsIgnoreCase("quit")) {
quit.execute(k, sender, login, hostname, command);
}
}
else if (command[1].equalsIgnoreCase("auth")) {
k.sendMessage(sender, "Tentative d'authentification ...");
if (command[2].equals(pass)) {
users.add(sender);
k.sendMessage(sender, "OK!");
} else {
k.sendMessage(sender, "Mot de passe Incorrect !");
}
}
else
{
k.sendMessage(sender,"Accée refusé , veuillez vous authentifier !");
}
}
} |