2012-05-13 32 views
0

有誰知道如何在PircBots中使用它? http://www.jibble.org/javadocs/pircbot/index.html 我只需要獲取用戶主機名並禁用它們。謝謝閱讀!PircBot如何獲得主機名

   if (cmd.equalsIgnoreCase("ban")) { 
         if (command[1] != null && command[2] != null) { 
          //Command[1] is the users name. 
          //Command[2] is the reason. 
          //how do i make this ban someone? 
         } 
        } 
+0

我讀過,我只是不知道如何解析主機名。 @JimGarrison –

回答

0

你不能禁止的理由,只踢理由。在這種情況下,我假設你想要kban,這是kick + ban。

  if (cmd.equalsIgnoreCase("ban")) { 
        if (command[1] != null && command[2] != null) { 
         //Command[1] is the users name. 
         //Command[2] is the reason. 
         //how do i make this ban someone? 

         // ban first 
         //make sure to input the current channel in "currentChannel" 
         ban(currentChannel, command[1]+"!*@*"); 

         // kick with a reason 
         kick(currentChannel, command[1], command[2]); 
        } 
       } 

如果你的命令需要一個主機遮罩,你應該讓用戶指定了 - 他可能需要一個特定的禁令,也許是一整套等否則禁止的,產生不良綽號禁令(如果用戶是離線使用,您可以使用「whowas」找出來,否則你應該使用「whois的」注意「whowas」可能無法正常工作)

從PircBot的JavaDoc的 - 。http://www.jibble.org/javadocs/pircbot/index.html

禁令(字符串通道,字符串主機屏蔽) 禁止某個用戶通過某個頻道。

kick(String channel,String nick) 從頻道中踢出用戶。

kick(String channel,String nick,String reason) 從某個頻道踢出用戶,給出原因。