Giveaway tweaks
This commit is contained in:
parent
4add7449eb
commit
ec7600a4a2
@ -24,7 +24,7 @@
|
||||
</profile>
|
||||
<profile default="false" name="Annotation profile for bungee" enabled="true">
|
||||
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||
<sourceTestOutputDir name="target\generated-test-sources\test-annotations" />
|
||||
<outputRelativeToContentRoot value="true" />
|
||||
<processorPath useClasspath="true" />
|
||||
</profile>
|
||||
|
@ -32,7 +32,7 @@ public class GiveawayManager extends MiniPlugin
|
||||
ServerCommandManager.getInstance().registerCommandType("GiveawayMessage", GiveawayMessage.class, new GiveawayMessageHandler());
|
||||
}
|
||||
|
||||
public void attemptToGiveaway(final String giveawayName, final String cooldownName, Player player, final Callback<GiveawayResponse> callback)
|
||||
public void attemptToGiveaway(final String giveawayName, final String cooldownName, final Player player, final Callback<GiveawayResponse> callback)
|
||||
{
|
||||
final int accountId = _clientManager.getAccountId(player);
|
||||
|
||||
@ -63,7 +63,7 @@ public class GiveawayManager extends MiniPlugin
|
||||
{
|
||||
final GiveawayResponse response;
|
||||
|
||||
if (_repository.canGiveaway(accountId, giveawayName))
|
||||
if (_repository.canGiveaway(accountId, giveawayName, cooldownName))
|
||||
{
|
||||
UUID uuid = UUID.randomUUID();
|
||||
if (_repository.addGiveaway(accountId, giveaway.getId(), cooldown.getId(), Region.US, "", uuid))
|
||||
@ -85,6 +85,19 @@ public class GiveawayManager extends MiniPlugin
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (response.isSuccess())
|
||||
{
|
||||
GiveawayMessage message = new GiveawayMessage(giveawayName, player.getName(), giveaway.getMessage(), giveaway.getHeader());
|
||||
message.publish();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
if (callback != null) callback.run(response);
|
||||
}
|
||||
});
|
||||
|
@ -8,6 +8,7 @@ import java.sql.Types;
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.database.DBPool;
|
||||
@ -28,17 +29,18 @@ public class GiveawayRepository extends RepositoryBase
|
||||
super(plugin, DBPool.ACCOUNT);
|
||||
}
|
||||
|
||||
public boolean canGiveaway(int accountId, String giveawayName)
|
||||
public boolean canGiveaway(int accountId, String giveawayName, String cooldownName)
|
||||
{
|
||||
try (Connection connection = getConnection();
|
||||
CallableStatement callableStatement = connection.prepareCall("{call check_giveaway(?, ?, ?)}"))
|
||||
CallableStatement callableStatement = connection.prepareCall("{call check_giveaway(?, ?, ?, ?)}"))
|
||||
{
|
||||
callableStatement.setInt(1, accountId);
|
||||
callableStatement.setString(2, giveawayName);
|
||||
callableStatement.registerOutParameter(3, Types.BOOLEAN);
|
||||
callableStatement.setString(3, cooldownName);
|
||||
callableStatement.registerOutParameter(4, Types.BOOLEAN);
|
||||
callableStatement.executeUpdate();
|
||||
|
||||
boolean pass = callableStatement.getBoolean(3);
|
||||
boolean pass = callableStatement.getBoolean(4);
|
||||
return pass;
|
||||
}
|
||||
catch (Exception e)
|
||||
|
@ -398,7 +398,7 @@ public class RewardManager
|
||||
RewardRarity rarity = type.generateRarity(requiresUncommon);
|
||||
|
||||
//Dont give Rank Upgrade if already has Titan
|
||||
if (rarity == RewardRarity.MYTHICAL)
|
||||
if (true || rarity == RewardRarity.MYTHICAL)
|
||||
{
|
||||
if (canGiveMythical && type == RewardType.MythicalChest/* && Math.random() <= 0.1*/)
|
||||
{
|
||||
|
@ -57,6 +57,8 @@ public class GiveawayReward extends Reward
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.println("GIVEAWAY FAILED: " + data.getFailReason().name());
|
||||
|
||||
// Dang, I guess we failed!
|
||||
if (!_clientManager.hasRank(player, Rank.TITAN))
|
||||
{
|
||||
|
@ -202,13 +202,12 @@ public class Treasure
|
||||
{
|
||||
final Reward reward = _rewards[_currentReward];
|
||||
data.setOpened(true);
|
||||
_currentReward++;
|
||||
reward.giveReward(_rewardType, _player, new Callback<RewardData>()
|
||||
{
|
||||
@Override
|
||||
public void run(RewardData rewardData)
|
||||
{
|
||||
_currentReward++;
|
||||
|
||||
if (swapList)
|
||||
{
|
||||
BlockInfo info = getBlockInfo(block);
|
||||
|
Loading…
Reference in New Issue
Block a user