Skip to content

Commit

Permalink
Fix op status for ~ and & users.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dorus committed Sep 21, 2014
1 parent 995f299 commit 6f0070e
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions werewolf/Werewolf.java
Original file line number Diff line number Diff line change
Expand Up @@ -539,10 +539,9 @@ private void joinGame(String sender) {
+ "the current game to finish before trying again.");
return;
}
// TODO: uncomment
// if (!isInChannel(sender)) {
// return;
// }
if (!isInChannel(sender)) {
return;
}
if (players2.isAdded(sender)) // has the player already joined?
{
sendNotice(sender, "You are already on the player list. Please wait for the next game to join again.");
Expand Down Expand Up @@ -761,7 +760,11 @@ protected boolean isSenderOp(String nick) // to check if the sender of a
User users[] = bot.getUsers(gameChan);

for (int i = 0; i < users.length; i++) {
if (users[i].getNick().equals(nick))
String nick2 = users[i].getNick();
if (nick2.equals("&" + nick) || nick2.equals("~" + nick)) {
return true;
}
if (nick2.equals(nick))
return users[i].isOp();
}
return false;
Expand Down Expand Up @@ -1079,7 +1082,8 @@ protected boolean isInChannel(String aName) {
User[] users = bot.getUsers(gameChan);

for (int i = 0; i < users.length; i++) {
if (users[i].getNick().equals(aName))
String nick = users[i].getNick();
if (aName.equals(nick) || aName.equals("&" + nick) || aName.equals("~" + nick))
return true;
}

Expand Down Expand Up @@ -1242,7 +1246,7 @@ public void timed() {
String rand;
do {
rand = users[((int) (Math.random() * users.length))].getNick();
} while (rand.equals(bot.getNick()));
} while (rand.equals(bot.getNick()) || rand.equals("~" + bot.getNick()) || rand.equals("&" + bot.getNick()));

String msg = getFromFile("BORED", rand, NOTICE);
if (msg != null)
Expand Down

0 comments on commit 6f0070e

Please sign in to comment.