*/
public class LotteryThread extends Thread
{
+
private static final Logger logger = LoggerFactory.getLogger(LotteryThread.class);
+ private static final String DEBUG_WINNER_ANNOUCE_FORMAT = "\00307%s\003 won \00311%s\003 in drawing No.\00313%d\003";
private AcidUser vizonUser;
private Channel channel;
+ "No.%d on %s! You are eligible to select a new vhost and "
+ "won a 1 letter nickname!", drawing.getId(), user.getNick()),
user.getNick());
+
+ privmsgDebugChannel(String.format(
+ DEBUG_WINNER_ANNOUCE_FORMAT,
+ user.getNick(),
+ "jackpot",
+ drawing.getId()));
}
private void notifyGrandPrizeWinner(VizonUser user)
+ "No.%d on %s! You are eligible to select a new vhost! Your "
+ "vhost will now be permanent!", drawing.getId(), user.getNick()),
user.getNick());
+
+ privmsgDebugChannel(String.format(
+ DEBUG_WINNER_ANNOUCE_FORMAT,
+ user.getNick(),
+ "grand prize",
+ drawing.getId()));
}
private void notifyFirstPrizeWinner(VizonUser user)
+ "No.%d on %s! You are eligible to select a new vhost! And your "
+ "vhost can be made bold!", drawing.getId(), user.getNick()),
user.getNick());
+
+ privmsgDebugChannel(String.format(
+ DEBUG_WINNER_ANNOUCE_FORMAT,
+ user.getNick(),
+ "first prize",
+ drawing.getId()));
}
private void notifySecondPrizeWinner(VizonUser user)
String.format("Congratulations, you won the second prize in VIzon "
+ "No.%d on %s! You are eligible to select a new vhost!", drawing.getId(), user.getNick()),
user.getNick());
+
+ privmsgDebugChannel(String.format(
+ DEBUG_WINNER_ANNOUCE_FORMAT,
+ user.getNick(),
+ "second prize",
+ drawing.getId()));
}
private void notifyThirdPrizeWinner(VizonUser user)
String.format("Congratulations, you won the third prize in VIzon "
+ "No.%d on %s! You are eligible to select a new colored vhost!", drawing.getId(), user.getNick()),
user.getNick());
+
+ privmsgDebugChannel(String.format(
+ DEBUG_WINNER_ANNOUCE_FORMAT,
+ user.getNick(),
+ "third prize",
+ drawing.getId()));
}
private void notifyConsolationPrizeWinner(VizonUser user)
String.format("Congratulations, you won the consolation prize in VIzon "
+ "No.%d on %s! You are eligible to select a new colored vhost!", drawing.getId(), user.getNick()),
user.getNick());
+
+ privmsgDebugChannel(String.format(
+ DEBUG_WINNER_ANNOUCE_FORMAT,
+ user.getNick(),
+ "consolation prize",
+ drawing.getId()));
}
private void notifyUser(User user, String message, String nick)
database.updateUser(user);
}
+ private void privmsgDebugChannel(String message)
+ {
+ Acidictive.privmsg(
+ vizonUser.getUID(),
+ Vizon.getVizonDebugChannel().getName(),
+ message);
+ }
+
private void privmsgChannel(String message)
{
Acidictive.privmsg(
*/
package net.rizon.acid.plugins.vizon;
-import net.rizon.acid.plugins.vizon.db.VizonDatabase;
-import net.rizon.acid.plugins.vizon.db.VizonUser;
-import net.rizon.acid.plugins.vizon.db.VizonDrawing;
import com.google.common.eventbus.Subscribe;
import io.netty.util.concurrent.ScheduledFuture;
import java.time.LocalDateTime;
import net.rizon.acid.plugins.Plugin;
import net.rizon.acid.plugins.vizon.commands.PendingRequestCommand;
import net.rizon.acid.plugins.vizon.conf.VizonConfig;
+import net.rizon.acid.plugins.vizon.db.VizonDatabase;
+import net.rizon.acid.plugins.vizon.db.VizonDrawing;
+import net.rizon.acid.plugins.vizon.db.VizonUser;
import net.rizon.acid.plugins.vizon.util.VizonTemporal;
import net.rizon.acid.sql.SQL;
import org.slf4j.Logger;
private static VizonConfig conf;
private static AcidUser vizonBot;
private static Channel vizonChannel;
-
+ private static Channel vizonDebugChannel;
+
private static SQL vizonSql;
private static VizonDatabase vizonDatabase;
return vizonChannel;
}
+ public static Channel getVizonDebugChannel()
+ {
+ return vizonDebugChannel;
+ }
+
public static SQL getVizonSql()
{
return vizonSql;
}
Channel channel = Channel.findChannel(conf.vizonChannel);
+ Channel debugChannel = Channel.findChannel(conf.vizonDebugChannel);
if (channel == null)
{
throw new ConfigException("VizonChannel does not exist");
}
+ if (debugChannel == null)
+ {
+ throw new ConfigException("VizonDebugChannel does not exist");
+ }
+
vizonBot = (AcidUser) u;
if (!vizonBot.isOnChan(channel))
}
vizonChannel = channel;
+ vizonDebugChannel = debugChannel;
}
}