fixes/debug
This commit is contained in:
parent
aa9fd1abf3
commit
bc7bf8a2e2
@ -40,11 +40,13 @@ public class TitanGiveawayManager extends MiniPlugin
|
||||
public void openPumpkin(final Player player, final Runnable onSuccess)
|
||||
{
|
||||
double rand = _random.nextDouble();
|
||||
System.out.println("a");
|
||||
if (!hasTitan(player) && rand < RANK_FIND_CHANCE)
|
||||
{
|
||||
final int accountId = _clientManager.getAccountId(player);
|
||||
final Region region = getRegion();
|
||||
final String serverName = getServerName();
|
||||
System.out.println("b");
|
||||
|
||||
// Need to check database that we can give away a rank
|
||||
runAsync(new Runnable()
|
||||
@ -53,9 +55,11 @@ public class TitanGiveawayManager extends MiniPlugin
|
||||
public void run()
|
||||
{
|
||||
final boolean pass = _repository.canGiveaway();
|
||||
System.out.println("c");
|
||||
|
||||
if (pass && _repository.addTitan(accountId, region, serverName))
|
||||
{
|
||||
System.out.println("C");
|
||||
runSync(new Runnable()
|
||||
{
|
||||
@Override
|
||||
@ -66,8 +70,10 @@ public class TitanGiveawayManager extends MiniPlugin
|
||||
@Override
|
||||
public void run(Rank rank)
|
||||
{
|
||||
System.out.println("d");
|
||||
if (rank == Rank.TITAN)
|
||||
{
|
||||
System.out.println("e");
|
||||
TitanGiveawayMessage message = new TitanGiveawayMessage(player.getName(), _repository.getTitanCount() + 1);
|
||||
message.publish();
|
||||
if (onSuccess != null) onSuccess.run();
|
||||
@ -87,7 +93,7 @@ public class TitanGiveawayManager extends MiniPlugin
|
||||
*/
|
||||
private boolean hasTitan(Player player)
|
||||
{
|
||||
return !_clientManager.hasRank(player, Rank.TITAN);
|
||||
return _clientManager.hasRank(player, Rank.TITAN);
|
||||
}
|
||||
|
||||
public Region getRegion()
|
||||
@ -109,9 +115,10 @@ public class TitanGiveawayManager extends MiniPlugin
|
||||
@EventHandler
|
||||
public void onCommand(PlayerCommandPreprocessEvent event)
|
||||
{
|
||||
if (event.getMessage().startsWith("/pumpkin"))
|
||||
if (event.getMessage().contains("pumpkin"))
|
||||
{
|
||||
openPumpkin(event.getPlayer(), null);
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user