Pushing titan giveaway stuff for laptop

This commit is contained in:
Shaun Bennett 2015-10-09 18:23:47 -04:00
parent 99fd88473b
commit 97ef4a4252
4 changed files with 131 additions and 1 deletions

View File

@ -209,7 +209,7 @@ public class AccountRepository extends RepositoryBase
{
public void run(final Rank response)
{
if (rank == Rank.ULTRA || rank == Rank.HERO || rank == Rank.LEGEND)
if (rank == Rank.ULTRA || rank == Rank.HERO || rank == Rank.LEGEND || rank == Rank.TITAN)
{
if (perm)
executeUpdate(UPDATE_ACCOUNT_RANK_DONOR_PERM, new ColumnVarChar("rank", 100, rank.toString()), new ColumnVarChar("donorRank", 100, rank.toString()), new ColumnVarChar("uuid", 100, uuid.toString()));

View File

@ -0,0 +1,60 @@
package nautilus.game.arcade.managers.titangiveaway;
import java.util.Random;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.MiniPlugin;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.Rank;
public class TitanGiveawayManager extends MiniPlugin
{
// private static final double RANK_FIND_CHANCE = 0.001;
private static final double RANK_FIND_CHANCE = 1;
private TitanGiveawayRepository _repository;
private CoreClientManager _clientManager;
private Random _random;
public TitanGiveawayManager(JavaPlugin plugin, CoreClientManager clientManager)
{
super("Titan Giveaway", plugin);
_repository = new TitanGiveawayRepository(plugin);
_clientManager = clientManager;
_random = new Random();
}
public void openPumpkin(Player player)
{
double rand = _random.nextDouble();
if (rand < RANK_FIND_CHANCE)
{
// Need to check database that we can give away a rank
runAsync(new Runnable()
{
@Override
public void run()
{
}
});
}
}
/**
* Confirm that the player doesn't already have TITAN rank
*/
private boolean canGiveRank(Player player)
{
return !_clientManager.hasRank(player, Rank.TITAN);
}
private void giveRank(Rank rank, Player player)
{
_clientManager.Get(player).SetRank(rank);
_clientManager.getRepository().saveRank(null, player.getName(), player.getUniqueId(), rank, true);
}
}

View File

@ -0,0 +1,20 @@
package nautilus.game.arcade.managers.titangiveaway;
import mineplex.serverdata.commands.ServerCommand;
public class TitanGiveawayMessage extends ServerCommand
{
private String _playerName;
public TitanGiveawayMessage(String playerName)
{
_playerName = playerName;
}
@Override
public void run()
{
super.run();
}
}

View File

@ -0,0 +1,50 @@
package nautilus.game.arcade.managers.titangiveaway;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.SQLType;
import java.sql.Types;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.database.DBPool;
import mineplex.core.database.RepositoryBase;
public class TitanGiveawayRepository extends RepositoryBase
{
private int _titanGiveawayCount;
public TitanGiveawayRepository(JavaPlugin plugin)
{
super(plugin, DBPool.ACCOUNT);
_titanGiveawayCount = 0;
}
@Override
protected void initialize()
{
}
@Override
protected void update()
{
}
public boolean canGiveaway()
{
try (Connection connection = getConnection();
CallableStatement callableStatement = connection.prepareCall("{call check_titanGiveaway(?)}"))
{
callableStatement.registerOutParameter(1, Types.BOOLEAN);
}
catch (Exception e)
{
}
return false;
}
}