Set up clans specific rewards for voting, daily bonus, and youtube clicks. Additionally, set up promotion for specific youtube channels in Carl. Finally, provide support for a differently-named creeper!
This commit is contained in:
parent
7e70d02751
commit
a691d58840
@ -11,8 +11,10 @@ public class BonusClientData
|
||||
|
||||
private int _accountId;
|
||||
private Timestamp _dailyTime;
|
||||
private Timestamp _clansDailyTime;
|
||||
private Date _rankTime;
|
||||
private Date _voteTime;
|
||||
private Date _clansVoteTime;
|
||||
private int _dailyStreak;
|
||||
private int _maxDailyStreak;
|
||||
private int _voteStreak;
|
||||
@ -43,6 +45,16 @@ public class BonusClientData
|
||||
{
|
||||
return _dailyTime;
|
||||
}
|
||||
|
||||
public void setClansDailyTime(Timestamp value)
|
||||
{
|
||||
_clansDailyTime = value;
|
||||
}
|
||||
|
||||
public Timestamp getClansDailyTime()
|
||||
{
|
||||
return _clansDailyTime;
|
||||
}
|
||||
|
||||
public void setRankTime(Date value)
|
||||
{
|
||||
@ -63,6 +75,16 @@ public class BonusClientData
|
||||
{
|
||||
return _voteTime;
|
||||
}
|
||||
|
||||
public void setClansVoteTime(Date value)
|
||||
{
|
||||
_clansVoteTime = value;
|
||||
}
|
||||
|
||||
public Date getClansVoteTime()
|
||||
{
|
||||
return _clansVoteTime;
|
||||
}
|
||||
|
||||
public void setDailyStreak(Integer value)
|
||||
{
|
||||
|
@ -8,10 +8,12 @@ import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TimeZone;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
@ -45,6 +47,7 @@ import mineplex.core.bonuses.gui.SpinGui;
|
||||
import mineplex.core.bonuses.gui.buttons.PowerPlayClubButton;
|
||||
import mineplex.core.bonuses.redis.VoteHandler;
|
||||
import mineplex.core.bonuses.redis.VotifierCommand;
|
||||
import mineplex.core.common.Pair;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.currency.GlobalCurrency;
|
||||
import mineplex.core.common.util.C;
|
||||
@ -86,17 +89,19 @@ import net.minecraft.server.v1_8_R3.PacketPlayOutEntityMetadata;
|
||||
|
||||
public class BonusManager extends MiniClientPlugin<BonusClientData> implements ILoginProcessor
|
||||
{
|
||||
|
||||
public static final TimeZone TIMEZONE = TimeZone.getTimeZone("UTC");
|
||||
|
||||
|
||||
private static long timeOffSet = 0;
|
||||
|
||||
private ArrayList<Object> _pendingExplosions = new ArrayList<>();
|
||||
private ArrayList<Player> _pendingExplosionsPlayers = new ArrayList<>();
|
||||
private final Map<UUID, Pair<String, Integer>> _homeServerMap = new ConcurrentHashMap<>();
|
||||
private Map<String, Boolean> _showCarl = new HashMap<>();
|
||||
private long _explode;
|
||||
private boolean _canVote;
|
||||
private boolean _animationRunning;
|
||||
|
||||
public final boolean ClansBonus;
|
||||
|
||||
public static long getSqlTime()
|
||||
{
|
||||
@ -144,6 +149,9 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
private int _visualTick;
|
||||
|
||||
private ArrayList<String> _voteList;
|
||||
private List<Pair<String, String>> _youtubers;
|
||||
|
||||
private String _creeperName;
|
||||
|
||||
/**
|
||||
* THIS SHOULD ONLY BE USED FOR VOTIFIER!
|
||||
@ -160,16 +168,37 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
|
||||
System.out.print("VOTIFIER: ");
|
||||
System.out.print("DONATION MANAGER - > " + _donationManager.toString());
|
||||
|
||||
|
||||
ClansBonus = _plugin.getClass().getSimpleName().equalsIgnoreCase("ClansHub");
|
||||
|
||||
_voteList = new ArrayList<>();
|
||||
_voteList.add("http://vote1.mineplex.com");
|
||||
_voteList.add("http://vote2.mineplex.com");
|
||||
_voteList.add("http://vote3.mineplex.com");
|
||||
if (ClansBonus)
|
||||
{
|
||||
_voteList.add("http://cvote1.mineplex.com");
|
||||
_voteList.add("http://cvote2.mineplex.com");
|
||||
_voteList.add("http://cvote3.mineplex.com");
|
||||
}
|
||||
else
|
||||
{
|
||||
_voteList.add("http://vote1.mineplex.com");
|
||||
_voteList.add("http://vote2.mineplex.com");
|
||||
_voteList.add("http://vote3.mineplex.com");
|
||||
}
|
||||
|
||||
_youtubers = new ArrayList<>();
|
||||
if (!ClansBonus)
|
||||
{
|
||||
_youtubers.add(Pair.create("Sigils", "https://www.youtube.com/user/SigilsPlaysGames?sub_confirmation=1"));
|
||||
_youtubers.add(Pair.create("SallyGreenGamer", "https://www.youtube.com/channel/UCt8eypdLUND5CBvgXzEZrxw?sub_confirmation=1"));
|
||||
}
|
||||
_youtubers.add(Pair.create("SamitoD", "https://www.youtube.com/user/SamitoD?sub_confirmation=1"));
|
||||
|
||||
_creeperName = "Carl";
|
||||
|
||||
updateOffSet();
|
||||
}
|
||||
|
||||
public BonusManager(JavaPlugin plugin, Location carlLocation, PlayWireManager playWireManager, CoreClientManager clientManager, DonationManager donationManager, PollManager pollManager, NpcManager npcManager, HologramManager hologramManager, StatsManager statsManager, InventoryManager inventoryManager, PetManager petManager, FacebookManager facebookManager, YoutubeManager youtubeManager, GadgetManager gadgetManager, ThankManager thankManager)
|
||||
public BonusManager(JavaPlugin plugin, Location carlLocation, PlayWireManager playWireManager, CoreClientManager clientManager, DonationManager donationManager, PollManager pollManager, NpcManager npcManager, HologramManager hologramManager, StatsManager statsManager, InventoryManager inventoryManager, PetManager petManager, FacebookManager facebookManager, YoutubeManager youtubeManager, GadgetManager gadgetManager, ThankManager thankManager, String creeperName)
|
||||
{
|
||||
super("Bonus", plugin);
|
||||
_repository = new BonusRepository(plugin, this, donationManager);
|
||||
@ -179,6 +208,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
_hologramManager = hologramManager;
|
||||
_inventoryManager = inventoryManager;
|
||||
_thankManager = thankManager;
|
||||
_creeperName = creeperName;
|
||||
|
||||
if (gadgetManager == null)
|
||||
{
|
||||
@ -196,15 +226,34 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
|
||||
_powerPlayClubRepository = new PowerPlayClubRepository(plugin, _clientManager, _donationManager);
|
||||
|
||||
ClansBonus = _plugin.getClass().getSimpleName().equalsIgnoreCase("ClansHub");
|
||||
|
||||
_voteList = new ArrayList<>();
|
||||
_voteList.add("http://vote1.mineplex.com");
|
||||
_voteList.add("http://vote2.mineplex.com");
|
||||
_voteList.add("http://vote3.mineplex.com");
|
||||
if (ClansBonus)
|
||||
{
|
||||
_voteList.add("http://cvote1.mineplex.com");
|
||||
_voteList.add("http://cvote2.mineplex.com");
|
||||
_voteList.add("http://cvote3.mineplex.com");
|
||||
}
|
||||
else
|
||||
{
|
||||
_voteList.add("http://vote1.mineplex.com");
|
||||
_voteList.add("http://vote2.mineplex.com");
|
||||
_voteList.add("http://vote3.mineplex.com");
|
||||
}
|
||||
_canVote = true;
|
||||
|
||||
_youtubers = new ArrayList<>();
|
||||
if (!ClansBonus)
|
||||
{
|
||||
_youtubers.add(Pair.create("Sigils", "https://www.youtube.com/user/SigilsPlaysGames?sub_confirmation=1"));
|
||||
_youtubers.add(Pair.create("SallyGreenGamer", "https://www.youtube.com/channel/UCt8eypdLUND5CBvgXzEZrxw?sub_confirmation=1"));
|
||||
}
|
||||
_youtubers.add(Pair.create("SamitoD", "https://www.youtube.com/user/SamitoD?sub_confirmation=1"));
|
||||
|
||||
if (npcManager != null)
|
||||
{
|
||||
_carlNpc = _npcManager.getNpcByName("Carl the Creeper");
|
||||
_carlNpc = _npcManager.getNpcByName(_creeperName + " the Creeper");
|
||||
if (_carlNpc == null)
|
||||
{
|
||||
_enabled = false;
|
||||
@ -230,6 +279,34 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
ServerCommandManager.getInstance().registerCommandType("VotifierCommand", VotifierCommand.class, new VoteHandler(this));
|
||||
|
||||
updateOffSet();
|
||||
|
||||
if (ClansBonus)
|
||||
{
|
||||
clientManager.addStoredProcedureLoginProcessor(new ILoginProcessor()
|
||||
{
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return "clans-server-id-loader";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processLoginResultSet(String playerName, UUID uuid, int accountId, ResultSet resultSet) throws SQLException
|
||||
{
|
||||
boolean hasRow = resultSet.next();
|
||||
if (hasRow)
|
||||
{
|
||||
_homeServerMap.put(uuid, Pair.create(resultSet.getString(1), resultSet.getInt(2)));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQuery(int accountId, String uuid, String name)
|
||||
{
|
||||
return "SELECT cs.serverName, cs.id FROM accountClan INNER JOIN clans ON clans.id = accountClan.clanId INNER JOIN clanServer AS cs ON clans.serverId = cs.id WHERE accountClan.accountId = " + accountId + ";";
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -251,7 +328,24 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
updateOffSet();
|
||||
}
|
||||
|
||||
public void handleVote(final Player player, final int gemsReceived)
|
||||
public String getCreeperName()
|
||||
{
|
||||
return _creeperName;
|
||||
}
|
||||
|
||||
public Pair<String, Integer> getClansHomeServer(Player player)
|
||||
{
|
||||
if (ClansBonus)
|
||||
{
|
||||
return _homeServerMap.getOrDefault(player.getUniqueId(), Pair.create("No Server", -1));
|
||||
}
|
||||
else
|
||||
{
|
||||
return Pair.create("No Server", -1);
|
||||
}
|
||||
}
|
||||
|
||||
public void handleVote(final Player player, final int rewardReceived, final boolean clans)
|
||||
{
|
||||
final int accountId = _clientManager.getAccountId(player);
|
||||
|
||||
@ -263,11 +357,21 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
data.setHologram(oldData.getHologram());
|
||||
}
|
||||
Set(player, data);
|
||||
|
||||
_statsManager.incrementStat(player, "Global.DailyVote", 1);
|
||||
addPendingExplosion(player, player.getName());
|
||||
UtilPlayer.message(player, F.main("Carl", "Thanks for voting for Mineplex!"));
|
||||
UtilPlayer.message(player, F.main("Carl", "You received " + F.elem(gemsReceived + " Gems") + " and " + F.elem("1 Carl Spinner Ticket") + "!"));
|
||||
|
||||
if (clans)
|
||||
{
|
||||
_statsManager.incrementStat(player, "Global.ClansDailyVote", 1);
|
||||
addPendingExplosion(player, player.getName());
|
||||
UtilPlayer.message(player, F.main(_creeperName, "Thanks for voting for Mineplex Clans!"));
|
||||
UtilPlayer.message(player, F.main(_creeperName, "You received " + F.elem(rewardReceived + " Gold") + " on your home server and " + F.elem("1 Spinner Ticket") + "!"));
|
||||
}
|
||||
else
|
||||
{
|
||||
_statsManager.incrementStat(player, "Global.DailyVote", 1);
|
||||
addPendingExplosion(player, player.getName());
|
||||
UtilPlayer.message(player, F.main(_creeperName, "Thanks for voting for Mineplex!"));
|
||||
UtilPlayer.message(player, F.main(_creeperName, "You received " + F.elem(rewardReceived + " Gems") + " and " + F.elem("1 Spinner Ticket") + "!"));
|
||||
}
|
||||
})));
|
||||
}
|
||||
|
||||
@ -383,21 +487,27 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
public static final long DAILY_STREAK_RESET_TIME = 1000 * 60 * 60 * 12;
|
||||
public static final long VOTE_STREAK_RESET_TIME = 1000 * 60 * 60 * 24;
|
||||
|
||||
public void attemptDailyBonus(final Player player, final BonusAmount amount, final Callback<Boolean> result)
|
||||
public void attemptDailyBonus(final Player player, final BonusAmount amount, final boolean clans, final Callback<Boolean> result)
|
||||
{
|
||||
if (timeTillDailyBonus(player) > 0)
|
||||
result.run(false);
|
||||
|
||||
getRepository().attemptDailyBonus(player, r ->
|
||||
getRepository().attemptDailyBonus(player, ClansBonus, r ->
|
||||
{
|
||||
if (r)
|
||||
{
|
||||
incrementDailyStreak(player);
|
||||
if (ClansBonus)
|
||||
{
|
||||
_statsManager.incrementStat(player, "Global.ClansDailyReward", 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
incrementDailyStreak(player);
|
||||
_statsManager.incrementStat(player, "Global.DailyReward", 1);
|
||||
}
|
||||
awardBonus(player, amount);
|
||||
updateCreeperVisual(player, true, C.cAqua);
|
||||
UtilPlayer.message(player, F.main("Carl", "Come back tomorrow for more!"));
|
||||
|
||||
_statsManager.incrementStat(player, "Global.DailyReward", 1);
|
||||
UtilPlayer.message(player, F.main(_creeperName, "Come back tomorrow for more!"));
|
||||
}
|
||||
|
||||
result.run(r);
|
||||
@ -412,7 +522,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
// This calculates the the next daily bonus, IT HAS TO MATCH THE MYSQL STORED FUNCTION.
|
||||
public long nextDailyBonus(Player player)
|
||||
{
|
||||
Timestamp timestamp = Get(player).getDailyTime();
|
||||
Timestamp timestamp = ClansBonus ? Get(player).getClansDailyTime() : Get(player).getDailyTime();
|
||||
|
||||
if (timestamp == null)
|
||||
return 0;
|
||||
@ -434,7 +544,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
{
|
||||
awardBonus(player, getRankBonusAmount(player));
|
||||
updateCreeperVisual(player, true, C.cAqua);
|
||||
UtilPlayer.message(player, F.main("Carl", "Come back next month for more!"));
|
||||
UtilPlayer.message(player, F.main(_creeperName, "Come back next month for more!"));
|
||||
}
|
||||
|
||||
result.run(aBoolean);
|
||||
@ -462,7 +572,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Carl", "There was an error processing your request. Try again later"));
|
||||
UtilPlayer.message(player, F.main(_creeperName, "There was an error processing your request. Try again later"));
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -604,6 +714,20 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
return amount;
|
||||
}
|
||||
|
||||
public BonusAmount getClansDailyBonusAmount(Player player)
|
||||
{
|
||||
BonusAmount amount = new BonusAmount();
|
||||
|
||||
int serverId = getClansHomeServer(player).getRight();
|
||||
|
||||
if (serverId != -1)
|
||||
{
|
||||
amount.setGold(serverId, 500);
|
||||
}
|
||||
|
||||
return amount;
|
||||
}
|
||||
|
||||
public BonusAmount getVoteBonusAmount(Player player)
|
||||
{
|
||||
return getVoteBonusAmount(Get(player).getVoteStreak());
|
||||
@ -620,6 +744,24 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
|
||||
return amount;
|
||||
}
|
||||
|
||||
public BonusAmount getClansVoteBonusAmount(Player player)
|
||||
{
|
||||
return getClansVoteBonusAmount(getClansHomeServer(player).getRight());
|
||||
}
|
||||
|
||||
public BonusAmount getClansVoteBonusAmount(int serverId)
|
||||
{
|
||||
BonusAmount amount = new BonusAmount();
|
||||
|
||||
if (serverId != -1)
|
||||
{
|
||||
amount.setTickets(1);
|
||||
amount.setGold(serverId, 1000);
|
||||
}
|
||||
|
||||
return amount;
|
||||
}
|
||||
|
||||
public BonusAmount getRankBonusAmount(Player player)
|
||||
{
|
||||
@ -663,7 +805,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
// This calculates the the next vote bonus, IT HAS TO MATCH THE MYSQL STORED FUNCTION.
|
||||
public long nextVoteTime(Player player)
|
||||
{
|
||||
Date date = Get(player).getVoteTime();
|
||||
Date date = ClansBonus ? Get(player).getClansVoteTime() : Get(player).getVoteTime();
|
||||
if (date == null)
|
||||
{
|
||||
return 0;
|
||||
@ -691,43 +833,43 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
|
||||
if (oldChests > 0)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem(oldChests + " Old Chests")));
|
||||
UtilPlayer.message(player, F.main(_creeperName, "Rewarded " + F.elem(oldChests + " Old Chests")));
|
||||
_inventoryManager.Get(player).addItem(new ClientItem(_inventoryManager.getItem(TreasureType.OLD.getItemName()), oldChests));
|
||||
}
|
||||
|
||||
if (ancientChests > 0)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem(ancientChests + " Ancient Chests")));
|
||||
UtilPlayer.message(player, F.main(_creeperName, "Rewarded " + F.elem(ancientChests + " Ancient Chests")));
|
||||
_inventoryManager.Get(player).addItem(new ClientItem(_inventoryManager.getItem(TreasureType.ANCIENT.getItemName()), ancientChests));
|
||||
}
|
||||
|
||||
if (mythicalChests > 0)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem(mythicalChests + " Mythical Chests")));
|
||||
UtilPlayer.message(player, F.main(_creeperName, "Rewarded " + F.elem(mythicalChests + " Mythical Chests")));
|
||||
_inventoryManager.Get(player).addItem(new ClientItem(_inventoryManager.getItem(TreasureType.MYTHICAL.getItemName()), mythicalChests));
|
||||
}
|
||||
|
||||
if (illuminatedChests > 0)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem(illuminatedChests + " Illuminated Chests")));
|
||||
UtilPlayer.message(player, F.main(_creeperName, "Rewarded " + F.elem(illuminatedChests + " Illuminated Chests")));
|
||||
_inventoryManager.Get(player).addItem(new ClientItem(_inventoryManager.getItem(TreasureType.ILLUMINATED.getItemName()), illuminatedChests));
|
||||
}
|
||||
|
||||
if (omegaChests > 0)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem(omegaChests + " Omega Chests")));
|
||||
UtilPlayer.message(player, F.main(_creeperName, "Rewarded " + F.elem(omegaChests + " Omega Chests")));
|
||||
_inventoryManager.Get(player).addItem(new ClientItem(_inventoryManager.getItem(TreasureType.OMEGA.getItemName()), omegaChests));
|
||||
}
|
||||
|
||||
if (gems > 0)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem(gems + " Gems")));
|
||||
UtilPlayer.message(player, F.main(_creeperName, "Rewarded " + F.elem(gems + " Gems")));
|
||||
_donationManager.rewardCurrencyUntilSuccess(GlobalCurrency.GEM, player, "Earned", gems);
|
||||
}
|
||||
|
||||
if (gold > 0)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem(gold + " Gold")));
|
||||
UtilPlayer.message(player, F.main(_creeperName, "Rewarded " + F.elem(gold + " Gold")));
|
||||
Set<Integer> serverIds = new HashSet<>();
|
||||
serverIds.addAll(amount.getGold().getServerIds());
|
||||
serverIds.addAll(amount.getBonusGold().getServerIds());
|
||||
@ -739,13 +881,13 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
|
||||
if (shards > 0)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem(shards + " Treasure Shards")));
|
||||
UtilPlayer.message(player, F.main(_creeperName, "Rewarded " + F.elem(shards + " Treasure Shards")));
|
||||
_donationManager.rewardCurrencyUntilSuccess(GlobalCurrency.TREASURE_SHARD, player, "Earned", shards);
|
||||
}
|
||||
|
||||
if (tickets > 0)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem(tickets + " Carl Spin Ticket")));
|
||||
UtilPlayer.message(player, F.main(_creeperName, "Rewarded " + F.elem(tickets + " Carl Spin Ticket")));
|
||||
final int accountId = coreClient.getAccountId();
|
||||
runAsync(() ->
|
||||
{
|
||||
@ -766,7 +908,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
if (experience > 0)
|
||||
{
|
||||
_statsManager.incrementStat(player, "Global.ExpEarned", experience);
|
||||
UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem(experience + " Experience")));
|
||||
UtilPlayer.message(player, F.main(_creeperName, "Rewarded " + F.elem(experience + " Experience")));
|
||||
}
|
||||
}
|
||||
|
||||
@ -856,6 +998,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
if (canVote(player)) availableRewards++;
|
||||
if (_playWireManager.Get(player) != null && _playWireManager.Get(player).getAccountId() != -1 && _playWireManager.canRedeemTickets(_playWireManager.Get(player))) availableRewards++;
|
||||
if (_youtubeManager.canYoutube(player)) availableRewards++;
|
||||
if (_youtubeManager.canSpecificYoutube(player)) availableRewards++;
|
||||
if (canRank(player) && _clientManager.hasRank(player, Rank.ULTRA) && isPastAugust()) availableRewards++;
|
||||
if (canDaily(player)) availableRewards++;
|
||||
if (getPollManager().getNextPoll(_pollManager.Get(player), _clientManager.Get(player).GetRank()) != null) availableRewards++;
|
||||
@ -1015,12 +1158,12 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
{
|
||||
if (Recharge.Instance.use(player, "Carl Inform", 240000, false, false))
|
||||
{
|
||||
if (_pollManager.hasPoll(player) || canVote(player) || (_playWireManager.Get(player) != null && _playWireManager.Get(player).getAccountId() != -1 && _playWireManager.canRedeemTickets(_playWireManager.Get(player))) || (canRank(player) && _clientManager.hasRank(player, Rank.ULTRA) && isPastAugust()) || canDaily(player) || PowerPlayClubButton.isAvailable(player, _powerPlayClubRepository))
|
||||
if (_pollManager.hasPoll(player) || canVote(player) || _youtubeManager.canSpecificYoutube(player) || _youtubeManager.canYoutube(player) || (_playWireManager.Get(player) != null && _playWireManager.Get(player).getAccountId() != -1 && _playWireManager.canRedeemTickets(_playWireManager.Get(player))) || (canRank(player) && _clientManager.hasRank(player, Rank.ULTRA) && isPastAugust()) || canDaily(player) || PowerPlayClubButton.isAvailable(player, _powerPlayClubRepository))
|
||||
{
|
||||
if (_showCarl.containsKey(player.getName()))
|
||||
{
|
||||
if (_plugin.getClass().getSimpleName().equalsIgnoreCase("Hub") || _plugin.getClass().getSimpleName().equalsIgnoreCase("ClansHub"))
|
||||
UtilPlayer.message(player, C.cDGreen + C.Bold + "Carl the Creeper>" + C.cGreen + " Hey " + player.getName().replace("s", "sss") + "! I have sssome amazing rewardsss for you! Come sssee me!");
|
||||
UtilPlayer.message(player, C.cDGreen + C.Bold + _creeperName + " the Creeper>" + C.cGreen + " Hey " + player.getName().replace("s", "sss") + "! I have sssome amazing rewardsss for you! Come sssee me!");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1036,6 +1179,23 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
int index = date % _voteList.size();
|
||||
return _voteList.get(index);
|
||||
}
|
||||
|
||||
public Pair<String, String> getSpecificCreator()
|
||||
{
|
||||
long sqlTime = getSqlTime();
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(sqlTime);
|
||||
int date = calendar.get(Calendar.DAY_OF_YEAR);
|
||||
if (_youtubers.size() >= 1)
|
||||
{
|
||||
int index = date % _youtubers.size();
|
||||
return _youtubers.get(index);
|
||||
}
|
||||
else
|
||||
{
|
||||
return Pair.create("MineplexGames", "http://youtube.com/mineplexgamesofficial?sub_confirmation=1");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Used for disabling rank rewards during first month of release
|
||||
|
@ -3,35 +3,35 @@ package mineplex.core.bonuses;
|
||||
import java.sql.CallableStatement;
|
||||
import java.sql.Connection;
|
||||
import java.sql.Date;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Timestamp;
|
||||
import java.sql.Types;
|
||||
|
||||
import mineplex.core.common.Pair;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.database.MinecraftRepository;
|
||||
import mineplex.serverdata.database.DBPool;
|
||||
import mineplex.serverdata.database.RepositoryBase;
|
||||
import mineplex.serverdata.database.ResultSetCallable;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.database.Tables;
|
||||
import mineplex.database.tables.records.BonusRecord;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.jooq.DSLContext;
|
||||
import org.jooq.Record2;
|
||||
import org.jooq.SQLDialect;
|
||||
import org.jooq.TableField;
|
||||
import org.jooq.impl.DSL;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import mineplex.core.common.Pair;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.database.Tables;
|
||||
import mineplex.database.tables.records.BonusRecord;
|
||||
import mineplex.serverdata.database.DBPool;
|
||||
import mineplex.serverdata.database.RepositoryBase;
|
||||
import mineplex.serverdata.database.ResultSetCallable;
|
||||
|
||||
public class BonusRepository extends RepositoryBase
|
||||
{
|
||||
private static String CREATE_BONUS_TABLE = "CREATE TABLE IF NOT EXISTS bonus (accountId INT NOT NULL AUTO_INCREMENT, dailytime TIMESTAMP NULL DEFAULT NULL, ranktime DATE NULL DEFAULT NULL, PRIMARY KEY (accountId), FOREIGN KEY (accountId) REFERENCES accounts(id));";
|
||||
private static String CREATE_BONUS_TABLE = "CREATE TABLE IF NOT EXISTS bonus (accountId INT NOT NULL AUTO_INCREMENT, dailytime TIMESTAMP NULL DEFAULT NULL, clansdailytime TIMESTAMP NULL DEFAULT NULL, ranktime DATE NULL DEFAULT NULL, votetime DATE NULL DEFAULT NULL, clansvotetime DATE NULL DEFAULT NULL, PRIMARY KEY (accountId), FOREIGN KEY (accountId) REFERENCES accounts(id));";
|
||||
private BonusManager _manager;
|
||||
private DonationManager _donationManager;
|
||||
|
||||
@ -63,6 +63,29 @@ public class BonusRepository extends RepositoryBase
|
||||
System.out.println("Loaded record. Daily time: " + record.getDailytime());
|
||||
return record;
|
||||
}
|
||||
|
||||
public int loadClansServerId(int accountId)
|
||||
{
|
||||
try (Connection connection = getConnection())
|
||||
{
|
||||
PreparedStatement s = connection.prepareStatement("SELECT cs.id FROM accountClan INNER JOIN clans ON clans.id = accountClan.clanId INNER JOIN clanServer AS cs ON clans.serverId = cs.id WHERE accountClan.accountId = " + accountId + ";");
|
||||
ResultSet rs = s.executeQuery();
|
||||
boolean hasRow = rs.next();
|
||||
if (hasRow)
|
||||
{
|
||||
return rs.getInt(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
public BonusClientData loadData(final int accountId, ResultSet resultSet) throws SQLException
|
||||
{
|
||||
@ -74,13 +97,15 @@ public class BonusRepository extends RepositoryBase
|
||||
{
|
||||
foundClient = true;
|
||||
clientData.setDailyTime(resultSet.getTimestamp(2));
|
||||
clientData.setRankTime(resultSet.getDate(3));
|
||||
clientData.setVoteTime(resultSet.getDate(4));
|
||||
clientData.setDailyStreak(resultSet.getInt(5));
|
||||
clientData.setMaxDailyStreak(resultSet.getInt(6));
|
||||
clientData.setVoteStreak(resultSet.getInt(7));
|
||||
clientData.setMaxVoteStreak(resultSet.getInt(8));
|
||||
clientData.setTickets(resultSet.getInt(9));
|
||||
clientData.setClansDailyTime(resultSet.getTimestamp(3));
|
||||
clientData.setRankTime(resultSet.getDate(4));
|
||||
clientData.setVoteTime(resultSet.getDate(5));
|
||||
clientData.setClansVoteTime(resultSet.getDate(6));
|
||||
clientData.setDailyStreak(resultSet.getInt(7));
|
||||
clientData.setMaxDailyStreak(resultSet.getInt(8));
|
||||
clientData.setVoteStreak(resultSet.getInt(9));
|
||||
clientData.setMaxVoteStreak(resultSet.getInt(10));
|
||||
clientData.setTickets(resultSet.getInt(11));
|
||||
}
|
||||
|
||||
if (!foundClient)
|
||||
@ -170,11 +195,13 @@ public class BonusRepository extends RepositoryBase
|
||||
});
|
||||
}
|
||||
|
||||
public void attemptDailyBonus(final Player player, final Callback<Boolean> result)
|
||||
public void attemptDailyBonus(final Player player, final boolean clans, final Callback<Boolean> result)
|
||||
{
|
||||
final int accountId = _manager.getClientManager().Get(player).getAccountId();
|
||||
final int serverId = _manager.getClansHomeServer(player).getRight();
|
||||
final int shards = 0;
|
||||
final int gems = 0;
|
||||
final int gold = 500;
|
||||
/*
|
||||
* if (shards == 0 && gems == 0) { result.accept(false); return; }
|
||||
*/
|
||||
@ -185,46 +212,93 @@ public class BonusRepository extends RepositoryBase
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
try (Connection connection = getConnection();
|
||||
CallableStatement callableStatement = connection.prepareCall("{call check_daily(?, ?, ?, ?, ?)}"))
|
||||
if (clans)
|
||||
{
|
||||
callableStatement.setInt(1, accountId);
|
||||
callableStatement.setInt(2, shards);
|
||||
callableStatement.setInt(3, gems);
|
||||
callableStatement.registerOutParameter(4, java.sql.Types.BOOLEAN);
|
||||
callableStatement.registerOutParameter(5, java.sql.Types.TIMESTAMP);
|
||||
|
||||
callableStatement.executeUpdate();
|
||||
|
||||
final boolean pass = callableStatement.getBoolean(4);
|
||||
|
||||
final Timestamp timeStamp = callableStatement.getTimestamp(5);
|
||||
|
||||
Bukkit.getScheduler().runTask(plug, new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
try (Connection connection = getConnection();
|
||||
CallableStatement callableStatement = connection.prepareCall("{call check_clans_daily(?, ?, ?, ?, ?)}"))
|
||||
{
|
||||
callableStatement.setInt(1, accountId);
|
||||
callableStatement.setInt(2, serverId);
|
||||
callableStatement.setInt(3, gold);
|
||||
callableStatement.registerOutParameter(4, java.sql.Types.BOOLEAN);
|
||||
callableStatement.registerOutParameter(5, java.sql.Types.TIMESTAMP);
|
||||
|
||||
if (pass)
|
||||
callableStatement.executeUpdate();
|
||||
|
||||
final boolean pass = callableStatement.getBoolean(4);
|
||||
|
||||
final Timestamp timeStamp = callableStatement.getTimestamp(5);
|
||||
|
||||
Bukkit.getScheduler().runTask(plug, new Runnable()
|
||||
{
|
||||
_manager.Get(player).setDailyTime(new Timestamp(BonusManager.getSqlTime()));
|
||||
result.run(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
Recharge.Instance.use(player, "AttemptDailyBonus", 1000 * 10, false, false);
|
||||
_manager.Get(player).setDailyTime(timeStamp);
|
||||
result.run(false);
|
||||
}
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
|
||||
if (pass)
|
||||
{
|
||||
_manager.Get(player).setClansDailyTime(new Timestamp(BonusManager.getSqlTime()));
|
||||
result.run(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
Recharge.Instance.use(player, "AttemptDailyBonus", 1000 * 10, false, false);
|
||||
_manager.Get(player).setClansDailyTime(timeStamp);
|
||||
result.run(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Recharge.Instance.use(player, "AttemptDailyBonus", 1000 * 30, false, false);
|
||||
e.printStackTrace();
|
||||
result.run(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (Exception e)
|
||||
else
|
||||
{
|
||||
Recharge.Instance.use(player, "AttemptDailyBonus", 1000 * 30, false, false);
|
||||
e.printStackTrace();
|
||||
result.run(false);
|
||||
try (Connection connection = getConnection();
|
||||
CallableStatement callableStatement = connection.prepareCall("{call check_daily(?, ?, ?, ?, ?)}"))
|
||||
{
|
||||
callableStatement.setInt(1, accountId);
|
||||
callableStatement.setInt(2, shards);
|
||||
callableStatement.setInt(3, gems);
|
||||
callableStatement.registerOutParameter(4, java.sql.Types.BOOLEAN);
|
||||
callableStatement.registerOutParameter(5, java.sql.Types.TIMESTAMP);
|
||||
|
||||
callableStatement.executeUpdate();
|
||||
|
||||
final boolean pass = callableStatement.getBoolean(4);
|
||||
|
||||
final Timestamp timeStamp = callableStatement.getTimestamp(5);
|
||||
|
||||
Bukkit.getScheduler().runTask(plug, new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
|
||||
if (pass)
|
||||
{
|
||||
_manager.Get(player).setDailyTime(new Timestamp(BonusManager.getSqlTime()));
|
||||
result.run(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
Recharge.Instance.use(player, "AttemptDailyBonus", 1000 * 10, false, false);
|
||||
_manager.Get(player).setDailyTime(timeStamp);
|
||||
result.run(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Recharge.Instance.use(player, "AttemptDailyBonus", 1000 * 30, false, false);
|
||||
e.printStackTrace();
|
||||
result.run(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -329,10 +403,12 @@ public class BonusRepository extends RepositoryBase
|
||||
});
|
||||
}
|
||||
|
||||
public void attemptVoteBonus(final int accountId, final Callback<Pair<Boolean, Date>> result)
|
||||
public void attemptVoteBonus(final int accountId, final boolean clans, final Callback<Pair<Boolean, Date>> result)
|
||||
{
|
||||
final int serverId = 0;
|
||||
final int shards = 0;
|
||||
final int gems = 0;
|
||||
final int gold = 1000;
|
||||
|
||||
final JavaPlugin plug = _manager.getPlugin();
|
||||
|
||||
@ -341,32 +417,62 @@ public class BonusRepository extends RepositoryBase
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if (clans)
|
||||
{
|
||||
try (Connection connection = getConnection();
|
||||
CallableStatement callableStatement = connection.prepareCall("{call check_clans_vote(?, ?, ?, ?, ?)}")) {
|
||||
callableStatement.setInt(1, accountId);
|
||||
callableStatement.setInt(2, serverId);
|
||||
callableStatement.setInt(3, gold);
|
||||
callableStatement.registerOutParameter(4, Types.BOOLEAN);
|
||||
callableStatement.registerOutParameter(5, Types.DATE);
|
||||
|
||||
try (Connection connection = getConnection();
|
||||
CallableStatement callableStatement = connection.prepareCall("{call check_vote(?, ?, ?, ?, ?)}")) {
|
||||
callableStatement.setInt(1, accountId);
|
||||
callableStatement.setInt(2, shards);
|
||||
callableStatement.setInt(3, gems);
|
||||
callableStatement.registerOutParameter(4, Types.BOOLEAN);
|
||||
callableStatement.registerOutParameter(5, Types.DATE);
|
||||
callableStatement.executeUpdate();
|
||||
|
||||
callableStatement.executeUpdate();
|
||||
final boolean pass = callableStatement.getBoolean(4);
|
||||
final Date date = callableStatement.getDate(5);
|
||||
|
||||
final boolean pass = callableStatement.getBoolean(4);
|
||||
final Date date = callableStatement.getDate(5);
|
||||
|
||||
Bukkit.getScheduler().runTask(plug, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
Bukkit.getScheduler().runTask(plug, new Runnable()
|
||||
{
|
||||
// _manager.Get(player).setVoteTime(date);
|
||||
result.run(Pair.create(pass, date));
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
result.run(null);
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
// _manager.Get(player).setVoteTime(date);
|
||||
result.run(Pair.create(pass, date));
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
result.run(null);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
try (Connection connection = getConnection();
|
||||
CallableStatement callableStatement = connection.prepareCall("{call check_vote(?, ?, ?, ?, ?)}")) {
|
||||
callableStatement.setInt(1, accountId);
|
||||
callableStatement.setInt(2, shards);
|
||||
callableStatement.setInt(3, gems);
|
||||
callableStatement.registerOutParameter(4, Types.BOOLEAN);
|
||||
callableStatement.registerOutParameter(5, Types.DATE);
|
||||
|
||||
callableStatement.executeUpdate();
|
||||
|
||||
final boolean pass = callableStatement.getBoolean(4);
|
||||
final Date date = callableStatement.getDate(5);
|
||||
|
||||
Bukkit.getScheduler().runTask(plug, new Runnable() {
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
// _manager.Get(player).setVoteTime(date);
|
||||
result.run(Pair.create(pass, date));
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
result.run(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -311,4 +311,4 @@ public class AnimationCarl extends Animation
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,32 +1,44 @@
|
||||
package mineplex.core.bonuses.gui;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import mineplex.core.bonuses.BonusManager;
|
||||
import mineplex.core.bonuses.gui.buttons.*;
|
||||
import mineplex.core.bonuses.gui.buttons.CarlSpinButton;
|
||||
import mineplex.core.bonuses.gui.buttons.ClaimTipsButton;
|
||||
import mineplex.core.bonuses.gui.buttons.DailyBonusButton;
|
||||
import mineplex.core.bonuses.gui.buttons.FacebookButton;
|
||||
import mineplex.core.bonuses.gui.buttons.PlayWireButton;
|
||||
import mineplex.core.bonuses.gui.buttons.PollButton;
|
||||
import mineplex.core.bonuses.gui.buttons.PowerPlayClubButton;
|
||||
import mineplex.core.bonuses.gui.buttons.RankBonusButton;
|
||||
import mineplex.core.bonuses.gui.buttons.SpecificChannelButton;
|
||||
import mineplex.core.bonuses.gui.buttons.TwitterButton;
|
||||
import mineplex.core.bonuses.gui.buttons.VoteButton;
|
||||
import mineplex.core.bonuses.gui.buttons.YoutubeButton;
|
||||
import mineplex.core.facebook.FacebookManager;
|
||||
import mineplex.core.gui.SimpleGui;
|
||||
import mineplex.core.playwire.PlayWireManager;
|
||||
import mineplex.core.reward.RewardManager;
|
||||
import mineplex.core.thank.ThankManager;
|
||||
import mineplex.core.youtube.YoutubeManager;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
public class BonusGui extends SimpleGui
|
||||
{
|
||||
private final int VOTE_SLOT = 40;
|
||||
private final int RANK_BONUS_SLOT = 10;
|
||||
private final int DAILY_BONUS_SLOT = 12;
|
||||
private final int POLL_SLOT = 28;
|
||||
private final int FACEBOOK_SLOT = 20;
|
||||
private final int CLAIM_TIPS_SLOT = 30;
|
||||
private final int POWER_PLAY_SLOT = 15;
|
||||
private final int CARL_SPINNER_SLOT = 13;
|
||||
private final int YOUTUBE_SLOT = 22;
|
||||
private final int TWITTER_SLOT = 34;
|
||||
private final int PLAY_WIRE_SLOT = 32;
|
||||
private final int SPECIFIC_YOUTUBE_SLOT = 24;
|
||||
|
||||
private final int VOTE_SLOT = 22;
|
||||
private final int RANK_BONUS_SLOT = 11;
|
||||
private final int DAILY_BONUS_SLOT = 13;
|
||||
private final int POLL_SLOT = 15;
|
||||
private final int FACEBOOK_SLOT = 18;
|
||||
private final int CLAIM_TIPS_SLOT = 26;
|
||||
private final int POWER_PLAY_SLOT = 20;
|
||||
private final int CARL_SPINNER_SLOT = 24;
|
||||
private final int YOUTUBE_SLOT = 29;
|
||||
private final int TWITTER_SLOT = 33;
|
||||
private final int PLAY_WIRE_SLOT = 31;
|
||||
|
||||
private static final int INV_SIZE = 45;
|
||||
private static final int INV_SIZE = 54;
|
||||
|
||||
public BonusGui(Plugin plugin, Player player, BonusManager manager, RewardManager rewardManager, FacebookManager facebookManager, YoutubeManager youtubeManager, ThankManager thankManager, PlayWireManager playWireManager)
|
||||
{
|
||||
@ -53,6 +65,8 @@ public class BonusGui extends SimpleGui
|
||||
setItem(CARL_SPINNER_SLOT, new CarlSpinButton(getPlugin(), player, manager, rewardManager));
|
||||
|
||||
setItem(PLAY_WIRE_SLOT, new PlayWireButton(playWireManager, player));
|
||||
|
||||
setItem(SPECIFIC_YOUTUBE_SLOT, new SpecificChannelButton(player, youtubeManager));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -2,6 +2,22 @@ package mineplex.core.bonuses.gui.buttons;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import mineplex.core.bonuses.BonusAmount;
|
||||
import mineplex.core.bonuses.BonusClientData;
|
||||
import mineplex.core.bonuses.BonusManager;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.F;
|
||||
@ -17,27 +33,9 @@ import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.shop.item.ShopItem;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.core.bonuses.BonusAmount;
|
||||
import mineplex.core.bonuses.BonusClientData;
|
||||
import mineplex.core.bonuses.BonusManager;
|
||||
import mineplex.core.bonuses.StreakRecord;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
public class DailyBonusButton implements GuiItem, Listener
|
||||
{
|
||||
|
||||
private ItemStack _item;
|
||||
|
||||
private Player _player;
|
||||
@ -75,29 +73,39 @@ public class DailyBonusButton implements GuiItem, Listener
|
||||
return;
|
||||
}
|
||||
|
||||
if (isAvailable()) {
|
||||
if (isAvailable() && canUse())
|
||||
{
|
||||
_item = ItemStackFactory.Instance.CreateStack(Material.LAPIS_BLOCK, (byte)0, 1, ChatColor.BLUE + "Processing...");
|
||||
refreshItem();
|
||||
new LoadingWindow(getPlugin(), getPlayer(), 6*9);
|
||||
_bonusManager.attemptDailyBonus(getPlayer(), _bonusManager.getDailyBonusAmount(_player), new Callback<Boolean>() {
|
||||
_bonusManager.attemptDailyBonus(getPlayer(), _bonusManager.ClansBonus ? _bonusManager.getClansDailyBonusAmount(_player) : _bonusManager.getDailyBonusAmount(_player), _bonusManager.ClansBonus, new Callback<Boolean>()
|
||||
{
|
||||
@Override
|
||||
public void run(Boolean t)
|
||||
{
|
||||
if (t) {
|
||||
|
||||
if (t)
|
||||
{
|
||||
setItem();
|
||||
|
||||
if (getPlayer().getOpenInventory() != null) {
|
||||
if (getPlayer().getOpenInventory() != null)
|
||||
{
|
||||
new TimedMessageWindow(getPlugin(), getPlayer(), ItemStackFactory.Instance.CreateStack(Material.STAINED_GLASS_PANE, DyeColor.LIME.getData(), 1, ChatColor.GREEN + "Bonus collected!"), "Bonus collected!", 6*9, 20*3, getGui()).openInventory();
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilPlayer.message(getPlayer(), F.main("Bonus", "Bonus collected!"));
|
||||
}
|
||||
_bonusManager.addPendingExplosion(getPlayer(), "DAILY");
|
||||
getPlayer().playSound(getPlayer().getLocation(), Sound.NOTE_PLING, 1, 1.6f);
|
||||
} else {
|
||||
if (getPlayer().getOpenInventory() != null) {
|
||||
}
|
||||
else
|
||||
{
|
||||
if (getPlayer().getOpenInventory() != null)
|
||||
{
|
||||
new TimedMessageWindow(getPlugin(), getPlayer(), ItemStackFactory.Instance.CreateStack(Material.STAINED_GLASS_PANE, DyeColor.RED.getData(), 1, ChatColor.RED + "Failed to collect bonus!"), "Failed to collect bonus!", 6*9, 20*3, getGui()).openInventory();
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilPlayer.message(getPlayer(), F.main("Bonus", "Failed to collect bonus!"));
|
||||
}
|
||||
getPlayer().playSound(getPlayer().getLocation(), Sound.ENDERDRAGON_GROWL, 1, 10);
|
||||
@ -105,8 +113,11 @@ public class DailyBonusButton implements GuiItem, Listener
|
||||
getPlayer().closeInventory();
|
||||
}
|
||||
});
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
getPlayer().playSound(getPlayer().getLocation(), Sound.ITEM_BREAK, 1, 10);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@ -125,7 +136,7 @@ public class DailyBonusButton implements GuiItem, Listener
|
||||
String itemName;
|
||||
byte data = 0;
|
||||
|
||||
if (isAvailable())
|
||||
if (isAvailable() && canUse())
|
||||
{
|
||||
material = Material.CHEST;
|
||||
itemName = C.cGreen + C.Bold + "Daily Reward";
|
||||
@ -133,6 +144,14 @@ public class DailyBonusButton implements GuiItem, Listener
|
||||
lore.add(" ");
|
||||
lore.add(ChatColor.RESET + "Click to Claim!");
|
||||
}
|
||||
else if (!canUse())
|
||||
{
|
||||
material = Material.REDSTONE_BLOCK;
|
||||
itemName = C.cRed + C.Bold + "Daily Reward";
|
||||
|
||||
lore.add(" ");
|
||||
lore.add(ChatColor.RESET + "You must set your home server by joining a clan to claim this!");
|
||||
}
|
||||
else
|
||||
{
|
||||
material = Material.REDSTONE_BLOCK;
|
||||
@ -143,37 +162,46 @@ public class DailyBonusButton implements GuiItem, Listener
|
||||
}
|
||||
|
||||
lore.add(" ");
|
||||
|
||||
BonusClientData client = _bonusManager.Get(_player);
|
||||
|
||||
BonusAmount bonusAmount = _bonusManager.getDailyBonusAmount(_player);
|
||||
bonusAmount.addLore(lore);
|
||||
lore.add(" ");
|
||||
|
||||
lore.add(C.cYellow + "Current Streak: " + C.cWhite + client.getDailyStreak());
|
||||
lore.add(C.cYellow + "Streak Bonus: " + C.cWhite + _bonusManager.getDailyMultiplier(_player) + "%");
|
||||
lore.add(" ");
|
||||
lore.add(C.cYellow + "Highest Streak: " + C.cWhite + client.getMaxDailyStreak());
|
||||
|
||||
if (client.getDailyTime() != null)
|
||||
|
||||
if (!_bonusManager.ClansBonus)
|
||||
{
|
||||
long lastBonus = _bonusManager.getLocalTime(client.getDailyTime().getTime());
|
||||
long timeLeft = _bonusManager.getStreakTimeRemaining(lastBonus, BonusManager.DAILY_STREAK_RESET_TIME);
|
||||
BonusClientData client = _bonusManager.Get(_player);
|
||||
|
||||
BonusAmount bonusAmount = _bonusManager.getDailyBonusAmount(_player);
|
||||
bonusAmount.addLore(lore);
|
||||
lore.add(" ");
|
||||
|
||||
if (timeLeft > 0)
|
||||
lore.add(C.cYellow + "Current Streak: " + C.cWhite + client.getDailyStreak());
|
||||
lore.add(C.cYellow + "Streak Bonus: " + C.cWhite + _bonusManager.getDailyMultiplier(_player) + "%");
|
||||
lore.add(" ");
|
||||
lore.add(C.cYellow + "Highest Streak: " + C.cWhite + client.getMaxDailyStreak());
|
||||
|
||||
if (client.getDailyTime() != null)
|
||||
{
|
||||
lore.add(C.cYellow + "Streak Reset: " + C.cWhite + UtilTime.convertString(timeLeft, 1, TimeUnit.FIT));
|
||||
long lastBonus = BonusManager.getLocalTime(client.getDailyTime().getTime());
|
||||
long timeLeft = _bonusManager.getStreakTimeRemaining(lastBonus, BonusManager.DAILY_STREAK_RESET_TIME);
|
||||
|
||||
if (timeLeft > 0)
|
||||
{
|
||||
lore.add(C.cYellow + "Streak Reset: " + C.cWhite + UtilTime.convertString(timeLeft, 1, TimeUnit.FIT));
|
||||
}
|
||||
}
|
||||
|
||||
// StreakRecord streakRecord = _bonusManager.getDailyStreak();
|
||||
// if (streakRecord != null)
|
||||
// {
|
||||
// lore.add(" ");
|
||||
// lore.add(C.cYellow + "Record: " + C.cWhite + streakRecord.getPlayerName());
|
||||
// lore.add(C.cYellow + "Streak: " + C.cWhite + streakRecord.getStreak());
|
||||
// }
|
||||
}
|
||||
else
|
||||
{
|
||||
lore.add(C.cYellow + "Home Server: " + C.cWhite + _bonusManager.getClansHomeServer(getPlayer()).getLeft());
|
||||
lore.add(" ");
|
||||
BonusAmount amount = _bonusManager.getClansDailyBonusAmount(_player);
|
||||
amount.addLore(lore);
|
||||
}
|
||||
|
||||
// StreakRecord streakRecord = _bonusManager.getDailyStreak();
|
||||
// if (streakRecord != null)
|
||||
// {
|
||||
// lore.add(" ");
|
||||
// lore.add(C.cYellow + "Record: " + C.cWhite + streakRecord.getPlayerName());
|
||||
// lore.add(C.cYellow + "Streak: " + C.cWhite + streakRecord.getStreak());
|
||||
// }
|
||||
|
||||
|
||||
_item = new ShopItem(material, itemName, lore.toArray(new String[0]), 1, false, false);
|
||||
}
|
||||
@ -200,6 +228,16 @@ public class DailyBonusButton implements GuiItem, Listener
|
||||
return (timeLeft() <= 0);
|
||||
}
|
||||
|
||||
public boolean canUse()
|
||||
{
|
||||
if (!_bonusManager.ClansBonus)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return _bonusManager.getClansHomeServer(getPlayer()).getRight() != -1;
|
||||
}
|
||||
|
||||
public Plugin getPlugin()
|
||||
{
|
||||
return _plugin;
|
||||
|
@ -0,0 +1,114 @@
|
||||
package mineplex.core.bonuses.gui.buttons;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.Managers;
|
||||
import mineplex.core.bonuses.BonusManager;
|
||||
import mineplex.core.common.Pair;
|
||||
import mineplex.core.common.jsonchat.ClickEvent;
|
||||
import mineplex.core.common.jsonchat.JsonMessage;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.gui.GuiItem;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.youtube.YoutubeManager;
|
||||
|
||||
public class SpecificChannelButton implements GuiItem
|
||||
{
|
||||
private final Player _player;
|
||||
private final YoutubeManager _youtubeManager;
|
||||
private Pair<String, String> _channel;
|
||||
private ItemStack _item;
|
||||
|
||||
public SpecificChannelButton(Player player, YoutubeManager youtubeManager)
|
||||
{
|
||||
_player = player;
|
||||
_youtubeManager = youtubeManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setup()
|
||||
{
|
||||
_channel = Managers.get(BonusManager.class).getSpecificCreator();
|
||||
if (_youtubeManager.canSpecificYoutube(_player))
|
||||
{
|
||||
_item = new ItemBuilder(Material.APPLE)
|
||||
.setTitle(C.cGreen + C.Bold + "Visit our featured creator " + _channel.getLeft())
|
||||
.addLore(
|
||||
C.cYellow + "Claim a Daily Reward",
|
||||
C.cWhite + "by checking out the latest Video",
|
||||
C.cWhite + "by " + _channel.getLeft() + "!",
|
||||
C.cWhite + " ",
|
||||
C.cWhite + "Be sure and Subscribe if you",
|
||||
C.cWhite + "enjoy their videos!",
|
||||
" ",
|
||||
C.cGreen + "Click to visit " + _channel.getLeft() + " on YouTube!"
|
||||
)
|
||||
.build();
|
||||
}
|
||||
else
|
||||
{
|
||||
_item = new ItemBuilder(Material.APPLE)
|
||||
.setTitle(C.cGreen + C.Bold + "Visit our featured creator " + _channel.getLeft())
|
||||
.addLore(
|
||||
C.cWhite + "Come back tomorrow for your",
|
||||
C.cWhite + "Daily Reward!",
|
||||
" ",
|
||||
C.cWhite + "Check out the latest Video",
|
||||
C.cWhite + "by " + _channel.getLeft() + "!",
|
||||
" ",
|
||||
C.cWhite + "Be sure and Subscribe if you",
|
||||
C.cWhite + "enjoy their videos!",
|
||||
" ",
|
||||
C.cGreen + "Click to visit " + _channel.getLeft() + " on YouTube!"
|
||||
)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {}
|
||||
|
||||
@Override
|
||||
public void click(ClickType clickType)
|
||||
{
|
||||
if (!Recharge.Instance.use(_player, "Use Youtube Button", 1000, false, false))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_player.closeInventory();
|
||||
|
||||
_player.playSound(_player.getLocation(), Sound.NOTE_PLING, 1, 1.6f);
|
||||
|
||||
final String message;
|
||||
if (_youtubeManager.canSpecificYoutube(_player))
|
||||
{
|
||||
message = "claim your Reward!";
|
||||
_youtubeManager.attemptSpecificYoutube(_player, Managers.get(BonusManager.class).ClansBonus, Managers.get(BonusManager.class).getClansHomeServer(_player).getRight());
|
||||
}
|
||||
else
|
||||
{
|
||||
message = "visit " + _channel.getLeft() + " on YouTube!";
|
||||
}
|
||||
|
||||
UtilPlayer.message(_player, C.cGold + C.Bold + C.Strike + "=============================================");
|
||||
UtilPlayer.message(_player, "");
|
||||
|
||||
new JsonMessage(" " + C.Bold + "Click to Open in Web Browser and " + message).click(ClickEvent.OPEN_URL, _channel.getRight()).sendToPlayer(_player);
|
||||
new JsonMessage( " " + C.cGreen + C.Line + _channel.getRight().replace("?sub_confirmation=1", "")).click(ClickEvent.OPEN_URL, _channel.getRight()).sendToPlayer(_player);
|
||||
UtilPlayer.message(_player, "");
|
||||
UtilPlayer.message(_player, C.cGold + C.Bold + C.Strike + "=============================================");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getObject()
|
||||
{
|
||||
return _item;
|
||||
}
|
||||
}
|
@ -103,7 +103,7 @@ public class VoteButton implements GuiItem, Listener
|
||||
String itemName;
|
||||
byte data = 0;
|
||||
|
||||
if (isAvailable())
|
||||
if (isAvailable() && canUse())
|
||||
{
|
||||
material = Material.JUKEBOX;
|
||||
itemName = C.cGreen + C.Bold + "Vote for Mineplex";
|
||||
@ -111,6 +111,14 @@ public class VoteButton implements GuiItem, Listener
|
||||
lore.add(" ");
|
||||
lore.add(ChatColor.RESET + "Click to Vote!");
|
||||
}
|
||||
else if (!canUse())
|
||||
{
|
||||
material = Material.REDSTONE_BLOCK;
|
||||
itemName = C.cRed + C.Bold + "Vote for Mineplex";
|
||||
|
||||
lore.add(" ");
|
||||
lore.add(ChatColor.RESET + "You must set your home server by joining a clan to receive voting rewards!");
|
||||
}
|
||||
else
|
||||
{
|
||||
material = Material.REDSTONE_BLOCK;
|
||||
@ -121,36 +129,46 @@ public class VoteButton implements GuiItem, Listener
|
||||
}
|
||||
|
||||
lore.add(" ");
|
||||
|
||||
BonusClientData client = _bonusManager.Get(_player);
|
||||
|
||||
BonusAmount bonusAmount = _bonusManager.getVoteBonusAmount(_player);
|
||||
bonusAmount.addLore(lore);
|
||||
lore.add(" ");
|
||||
|
||||
lore.add(C.cYellow + "Current Streak: " + C.cWhite + client.getVoteStreak());
|
||||
lore.add(C.cYellow + "Streak Bonus: " + C.cWhite + "+" + _bonusManager.getVoteMultiplier(client.getVoteStreak()) + "%");
|
||||
if (client.getVoteTime() != null)
|
||||
|
||||
if (!_bonusManager.ClansBonus)
|
||||
{
|
||||
long lastBonus = _bonusManager.getLocalTime(client.getVoteTime().getTime());
|
||||
long timeLeft = _bonusManager.getStreakTimeRemaining(lastBonus, BonusManager.VOTE_STREAK_RESET_TIME);
|
||||
BonusClientData client = _bonusManager.Get(_player);
|
||||
|
||||
if (timeLeft > 0)
|
||||
BonusAmount bonusAmount = _bonusManager.getVoteBonusAmount(_player);
|
||||
bonusAmount.addLore(lore);
|
||||
lore.add(" ");
|
||||
|
||||
lore.add(C.cYellow + "Current Streak: " + C.cWhite + client.getVoteStreak());
|
||||
lore.add(C.cYellow + "Streak Bonus: " + C.cWhite + "+" + _bonusManager.getVoteMultiplier(client.getVoteStreak()) + "%");
|
||||
if (client.getVoteTime() != null)
|
||||
{
|
||||
lore.add(C.cYellow + "Streak Reset: " + C.cWhite + UtilTime.convertString(timeLeft, 1, TimeUnit.FIT));
|
||||
long lastBonus = _bonusManager.getLocalTime(client.getVoteTime().getTime());
|
||||
long timeLeft = _bonusManager.getStreakTimeRemaining(lastBonus, BonusManager.VOTE_STREAK_RESET_TIME);
|
||||
|
||||
if (timeLeft > 0)
|
||||
{
|
||||
lore.add(C.cYellow + "Streak Reset: " + C.cWhite + UtilTime.convertString(timeLeft, 1, TimeUnit.FIT));
|
||||
}
|
||||
}
|
||||
|
||||
lore.add(" ");
|
||||
lore.add(C.cYellow + "Highest Streak: " + C.cWhite + client.getMaxVoteStreak());
|
||||
|
||||
// StreakRecord streakRecord = _bonusManager.getVoteStreak();
|
||||
// if (streakRecord != null)
|
||||
// {
|
||||
// lore.add(" ");
|
||||
// lore.add(C.cYellow + "Record: " + C.cWhite + streakRecord.getPlayerName());
|
||||
// lore.add(C.cYellow + "Streak: " + C.cWhite + streakRecord.getStreak());
|
||||
// }
|
||||
}
|
||||
else
|
||||
{
|
||||
lore.add(C.cYellow + "Home Server: " + C.cWhite + _bonusManager.getClansHomeServer(getPlayer()).getLeft());
|
||||
lore.add(" ");
|
||||
BonusAmount amount = _bonusManager.getClansVoteBonusAmount(_player);
|
||||
amount.addLore(lore);
|
||||
}
|
||||
|
||||
lore.add(" ");
|
||||
lore.add(C.cYellow + "Highest Streak: " + C.cWhite + client.getMaxVoteStreak());
|
||||
|
||||
// StreakRecord streakRecord = _bonusManager.getVoteStreak();
|
||||
// if (streakRecord != null)
|
||||
// {
|
||||
// lore.add(" ");
|
||||
// lore.add(C.cYellow + "Record: " + C.cWhite + streakRecord.getPlayerName());
|
||||
// lore.add(C.cYellow + "Streak: " + C.cWhite + streakRecord.getStreak());
|
||||
// }
|
||||
|
||||
_item = new ShopItem(material, itemName, lore.toArray(new String[0]), 1, false, false);
|
||||
}
|
||||
@ -168,6 +186,16 @@ public class VoteButton implements GuiItem, Listener
|
||||
return (timeLeft() <= 0);
|
||||
}
|
||||
|
||||
public boolean canUse()
|
||||
{
|
||||
if (!_bonusManager.ClansBonus)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return _bonusManager.getClansHomeServer(getPlayer()).getRight() != -1;
|
||||
}
|
||||
|
||||
public Plugin getPlugin()
|
||||
{
|
||||
return _plugin;
|
||||
|
@ -1,5 +1,7 @@
|
||||
package mineplex.core.bonuses.gui.buttons;
|
||||
|
||||
import mineplex.core.Managers;
|
||||
import mineplex.core.bonuses.BonusManager;
|
||||
import mineplex.core.common.jsonchat.ClickEvent;
|
||||
import mineplex.core.common.jsonchat.JsonMessage;
|
||||
import mineplex.core.common.util.C;
|
||||
@ -20,7 +22,7 @@ public class YoutubeButton implements GuiItem
|
||||
.setTitle(C.cGreen + C.Bold + "Visit us on YouTube")
|
||||
.addLore(
|
||||
C.cWhite + "Come back tomorrow for your",
|
||||
C.cWhite + "Daily 250 Shard Reward!",
|
||||
C.cWhite + "Daily Reward!",
|
||||
" ",
|
||||
C.cWhite + "Check out the latest Video",
|
||||
C.cWhite + "on the MineplexGames Channel!",
|
||||
@ -34,7 +36,7 @@ public class YoutubeButton implements GuiItem
|
||||
private static final ItemStack ENABLED_ICON = new ItemBuilder(Material.APPLE)
|
||||
.setTitle(C.cGreen + C.Bold + "Visit us on YouTube")
|
||||
.addLore(
|
||||
C.cYellow + "Claim your Daily 250 Shard Reward",
|
||||
C.cYellow + "Claim your Daily Reward",
|
||||
C.cWhite + "by checking out the latest Video",
|
||||
C.cWhite + "on the MineplexGames Channel!",
|
||||
C.cWhite + " ",
|
||||
@ -75,7 +77,7 @@ public class YoutubeButton implements GuiItem
|
||||
if (_youtubeManager.canYoutube(_player))
|
||||
{
|
||||
message = "claim YouTube Prize!";
|
||||
_youtubeManager.attemptYoutube(_player);
|
||||
_youtubeManager.attemptYoutube(_player, Managers.get(BonusManager.class).ClansBonus, Managers.get(BonusManager.class).getClansHomeServer(_player).getRight());
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -96,4 +98,4 @@ public class YoutubeButton implements GuiItem
|
||||
{
|
||||
return _youtubeManager.canYoutube(_player) ? ENABLED_ICON : DISABLED_ICON;
|
||||
}
|
||||
}
|
||||
}
|
@ -25,7 +25,7 @@ public class VoteHandler implements CommandCallback
|
||||
|
||||
if (player != null)
|
||||
{
|
||||
_bonusManager.handleVote(player, v.getGemsReceived());
|
||||
_bonusManager.handleVote(player, v.getRewardReceived(), v.isClans());
|
||||
}
|
||||
}
|
||||
}
|
@ -5,14 +5,16 @@ import mineplex.serverdata.commands.ServerCommand;
|
||||
public class VotifierCommand extends ServerCommand
|
||||
{
|
||||
private String _playerName;
|
||||
private int _gemsReceived;
|
||||
private int _rewardReceived;
|
||||
private boolean _clans;
|
||||
|
||||
public VotifierCommand(String playerName, int gemsReceived, String... targetServer)
|
||||
public VotifierCommand(String playerName, int rewardReceived, boolean clans, String... targetServer)
|
||||
{
|
||||
super(targetServer);
|
||||
|
||||
_playerName = playerName;
|
||||
_gemsReceived = gemsReceived;
|
||||
_rewardReceived = rewardReceived;
|
||||
_clans = clans;
|
||||
}
|
||||
|
||||
public String getPlayerName()
|
||||
@ -20,8 +22,13 @@ public class VotifierCommand extends ServerCommand
|
||||
return _playerName;
|
||||
}
|
||||
|
||||
public int getGemsReceived()
|
||||
public int getRewardReceived()
|
||||
{
|
||||
return _gemsReceived;
|
||||
return _rewardReceived;
|
||||
}
|
||||
|
||||
public boolean isClans()
|
||||
{
|
||||
return _clans;
|
||||
}
|
||||
}
|
@ -17,7 +17,6 @@ import mineplex.core.Managers;
|
||||
import mineplex.core.MiniDbClientPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.bonuses.BonusManager;
|
||||
import mineplex.core.common.currency.GlobalCurrency;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.F;
|
||||
@ -97,12 +96,12 @@ public class PlayWireManager extends MiniDbClientPlugin<PlayWireClientData>
|
||||
final PlayWireClientData client = Get(player);
|
||||
if (client == null || client.getAccountId() == -1)
|
||||
{
|
||||
player.sendMessage(ResponseType.UNFILLED.getMessage());
|
||||
player.sendMessage(ResponseType.UNFILLED.getMessage(Managers.get(BonusManager.class).getCreeperName()));
|
||||
return;
|
||||
}
|
||||
if (!canRedeemTickets(client))
|
||||
{
|
||||
player.sendMessage(ResponseType.UNCOUNTED.getMessage(UtilTime.MakeStr(client.getTicketRefresh() - System.currentTimeMillis())));
|
||||
player.sendMessage(ResponseType.UNCOUNTED.getMessage(Managers.get(BonusManager.class).getCreeperName(), UtilTime.MakeStr(client.getTicketRefresh() - System.currentTimeMillis())));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -150,7 +149,7 @@ public class PlayWireManager extends MiniDbClientPlugin<PlayWireClientData>
|
||||
}
|
||||
});
|
||||
Managers.get(BonusManager.class).addPendingExplosion(player, player.getName());
|
||||
Bukkit.getScheduler().runTaskLater(getClientManager().getPlugin(), () -> UtilPlayer.message(player, ResponseType.COUNTED.getMessage(client.getTicketsRemaining() + "")), REWARD_MESSAGE_DELAY_SECONDS * 20L);
|
||||
Bukkit.getScheduler().runTaskLater(getClientManager().getPlugin(), () -> UtilPlayer.message(player, ResponseType.COUNTED.getMessage(Managers.get(BonusManager.class).getCreeperName(), client.getTicketsRemaining() + "")), REWARD_MESSAGE_DELAY_SECONDS * 20L);
|
||||
});
|
||||
}
|
||||
|
||||
@ -179,7 +178,7 @@ public class PlayWireManager extends MiniDbClientPlugin<PlayWireClientData>
|
||||
}
|
||||
else
|
||||
{
|
||||
player.sendMessage(response.getMessage());
|
||||
player.sendMessage(response.getMessage(Managers.get(BonusManager.class).getCreeperName()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,10 +7,10 @@ import mineplex.core.common.util.F;
|
||||
*/
|
||||
public enum ResponseType
|
||||
{
|
||||
COUNTED(F.main("Carl", "Rewarded " + F.elem("1 Carl Spin Ticket") + " for watching the Ad! You have " + F.elem("%elem%") + " tickets remaining for the current 24 hour period!")),
|
||||
UNCOUNTED(F.main("Carl", "You already received your " + F.elem("5 Carl Spin Tickets") + " for the current 24 hour period! Your available tickets will refresh in " + F.elem("%elem%") + "!")),
|
||||
BLOCKED(F.main("Carl", "You have an AdBlocker on, but tried to watch the Ad! Ssssssslight problem there!")),
|
||||
UNFILLED(F.main("Carl", "Ssssomething went wrong with the Ad, we'll get it ssssorted ASAP. Try again in a few minutessss!")),;
|
||||
COUNTED(F.main("%creeper%", "Rewarded " + F.elem("1 Spin Ticket") + " for watching the Ad! You have " + F.elem("%elem%") + " tickets remaining for the current 24 hour period!")),
|
||||
UNCOUNTED(F.main("%creeper%", "You already received your " + F.elem("5 Spin Tickets") + " for the current 24 hour period! Your available tickets will refresh in " + F.elem("%elem%") + "!")),
|
||||
BLOCKED(F.main("%creeper%", "You have an AdBlocker on, but tried to watch the Ad! Ssssssslight problem there!")),
|
||||
UNFILLED(F.main("%creeper%", "Ssssomething went wrong with the Ad, we'll get it ssssorted ASAP. Try again in a few minutessss!")),;
|
||||
|
||||
private String _message;
|
||||
|
||||
@ -19,9 +19,10 @@ public enum ResponseType
|
||||
_message = message;
|
||||
}
|
||||
|
||||
public String getMessage(String... elements)
|
||||
public String getMessage(String creeperName, String... elements)
|
||||
{
|
||||
String message = _message;
|
||||
message = message.replaceFirst("%creeper%", creeperName);
|
||||
if (elements.length > 0)
|
||||
{
|
||||
for (int i = 0; i < elements.length; i++)
|
||||
|
@ -5,19 +5,31 @@ import java.time.LocalDate;
|
||||
public class YoutubeClient
|
||||
{
|
||||
private LocalDate _clickDate;
|
||||
private LocalDate _specificDate;
|
||||
|
||||
public YoutubeClient(LocalDate date)
|
||||
public YoutubeClient(LocalDate date, LocalDate specificDate)
|
||||
{
|
||||
this._clickDate = date;
|
||||
_clickDate = date;
|
||||
_specificDate = specificDate;
|
||||
}
|
||||
|
||||
public LocalDate getClickDate()
|
||||
{
|
||||
return _clickDate;
|
||||
}
|
||||
|
||||
public LocalDate getSpecificDate()
|
||||
{
|
||||
return _specificDate;
|
||||
}
|
||||
|
||||
public void setClickDate(LocalDate date)
|
||||
{
|
||||
_clickDate = date;
|
||||
}
|
||||
}
|
||||
|
||||
public void setSpecificDate(LocalDate date)
|
||||
{
|
||||
_specificDate = date;
|
||||
}
|
||||
}
|
@ -1,15 +1,5 @@
|
||||
package mineplex.core.youtube;
|
||||
|
||||
import mineplex.core.MiniDbClientPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.currency.GlobalCurrency;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.time.LocalDate;
|
||||
@ -17,6 +7,18 @@ import java.time.ZoneOffset;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.MiniDbClientPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.account.ILoginProcessor;
|
||||
import mineplex.core.common.currency.GlobalCurrency;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
|
||||
public class YoutubeManager extends MiniDbClientPlugin<YoutubeClient>
|
||||
{
|
||||
private static final int REWARD_MESSAGE_DELAY_SECONDS = 30;
|
||||
@ -28,6 +30,31 @@ public class YoutubeManager extends MiniDbClientPlugin<YoutubeClient>
|
||||
super("YoutubeManager", plugin, clientManager);
|
||||
_donationManager = donationManager;
|
||||
_repository = new YoutubeRepository(this);
|
||||
|
||||
clientManager.addStoredProcedureLoginProcessor(new ILoginProcessor()
|
||||
{
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return "specific-youtuber-click";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processLoginResultSet(String playerName, UUID uuid, int accountId, ResultSet resultSet) throws SQLException
|
||||
{
|
||||
boolean hasRow = resultSet.next();
|
||||
if (hasRow)
|
||||
{
|
||||
YoutubeManager.this.Get(uuid).setSpecificDate(resultSet.getDate(1).toLocalDate());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQuery(int accountId, String uuid, String name)
|
||||
{
|
||||
return "SELECT clicktime FROM specificyoutube WHERE accountId=" + accountId + ";";
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public boolean canYoutube(Player player)
|
||||
@ -45,19 +72,72 @@ public class YoutubeManager extends MiniDbClientPlugin<YoutubeClient>
|
||||
|
||||
return !date.equals(utc);
|
||||
}
|
||||
|
||||
public boolean canSpecificYoutube(Player player)
|
||||
{
|
||||
YoutubeClient client = Get(player);
|
||||
LocalDate date = client.getSpecificDate();
|
||||
|
||||
public void attemptYoutube(Player player)
|
||||
if (date == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
ZonedDateTime utcZoned = ZonedDateTime.now(ZoneOffset.UTC);
|
||||
LocalDate utc = utcZoned.toLocalDate();
|
||||
|
||||
return !date.equals(utc);
|
||||
}
|
||||
|
||||
public void attemptYoutube(Player player, boolean clans, final int clansServerId)
|
||||
{
|
||||
if (!canYoutube(player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
YoutubeClient client = Get(player);
|
||||
final int accountId = getClientManager().getAccountId(player);
|
||||
client.setClickDate(ZonedDateTime.now(ZoneOffset.UTC).toLocalDate());
|
||||
_repository.attemptYoutube(player, client, () ->
|
||||
{
|
||||
_donationManager.rewardCurrency(GlobalCurrency.TREASURE_SHARD, player, "YouTube", 250);
|
||||
Bukkit.getScheduler().runTaskLater(getClientManager().getPlugin(), () -> UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem("250 Treasure Shards") + " for watching the YouTube video")), REWARD_MESSAGE_DELAY_SECONDS * 20L);
|
||||
if (clans && clansServerId != -1)
|
||||
{
|
||||
_donationManager.getGoldRepository().rewardGold(success ->
|
||||
{
|
||||
Bukkit.getScheduler().runTaskLater(getClientManager().getPlugin(), () -> UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem("250 Gold") + " on your home server for watching the YouTube video")), REWARD_MESSAGE_DELAY_SECONDS * 20L);
|
||||
}, clansServerId, accountId, 250);
|
||||
}
|
||||
else
|
||||
{
|
||||
_donationManager.rewardCurrency(GlobalCurrency.TREASURE_SHARD, player, "YouTube", 250);
|
||||
Bukkit.getScheduler().runTaskLater(getClientManager().getPlugin(), () -> UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem("250 Treasure Shards") + " for watching the YouTube video")), REWARD_MESSAGE_DELAY_SECONDS * 20L);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void attemptSpecificYoutube(Player player, final boolean clans, final int clansServerId)
|
||||
{
|
||||
if (!canYoutube(player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
YoutubeClient client = Get(player);
|
||||
final int accountId = getClientManager().getAccountId(player);
|
||||
client.setSpecificDate(ZonedDateTime.now(ZoneOffset.UTC).toLocalDate());
|
||||
_repository.attemptSpecificYoutube(player, client, () ->
|
||||
{
|
||||
if (clans && clansServerId != -1)
|
||||
{
|
||||
_donationManager.getGoldRepository().rewardGold(success ->
|
||||
{
|
||||
Bukkit.getScheduler().runTaskLater(getClientManager().getPlugin(), () -> UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem("250 Gold") + " on your home server for watching the YouTube video")), REWARD_MESSAGE_DELAY_SECONDS * 20L);
|
||||
}, clansServerId, accountId, 250);
|
||||
}
|
||||
else
|
||||
{
|
||||
_donationManager.rewardCurrency(GlobalCurrency.TREASURE_SHARD, player, "YouTube", 250);
|
||||
Bukkit.getScheduler().runTaskLater(getClientManager().getPlugin(), () -> UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem("250 Treasure Shards") + " for watching the YouTube video")), REWARD_MESSAGE_DELAY_SECONDS * 20L);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -66,9 +146,9 @@ public class YoutubeManager extends MiniDbClientPlugin<YoutubeClient>
|
||||
{
|
||||
boolean hasRow = resultSet.next();
|
||||
if (hasRow)
|
||||
Set(uuid, new YoutubeClient(resultSet.getDate(1).toLocalDate()));
|
||||
Set(uuid, new YoutubeClient(resultSet.getDate(1).toLocalDate(), null));
|
||||
else
|
||||
Set(uuid, new YoutubeClient(null));
|
||||
Set(uuid, new YoutubeClient(null, null));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -80,6 +160,6 @@ public class YoutubeManager extends MiniDbClientPlugin<YoutubeClient>
|
||||
@Override
|
||||
protected YoutubeClient addPlayer(UUID uuid)
|
||||
{
|
||||
return new YoutubeClient(null);
|
||||
return new YoutubeClient(null, null);
|
||||
}
|
||||
}
|
||||
}
|
@ -39,5 +39,26 @@ public class YoutubeRepository
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void attemptSpecificYoutube(Player player, YoutubeClient client, Runnable runnable)
|
||||
{
|
||||
int accountId = _manager.getClientManager().Get(player).getAccountId();
|
||||
|
||||
}
|
||||
Bukkit.getScheduler().runTaskAsynchronously(_manager.getPlugin(), () ->
|
||||
{
|
||||
try (Connection connection = DBPool.getAccount().getConnection())
|
||||
{
|
||||
PreparedStatement statement = connection.prepareStatement("REPLACE INTO specificyoutube (accountId, clicktime) VALUES (?, ?)");
|
||||
statement.setInt(1, accountId);
|
||||
statement.setDate(2, Date.valueOf(client.getSpecificDate()));
|
||||
statement.executeUpdate();
|
||||
|
||||
runnable.run();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -81,6 +81,19 @@ public class Routines {
|
||||
p.execute(configuration);
|
||||
return p;
|
||||
}
|
||||
|
||||
/**
|
||||
* Call <code>Account.check_clans_daily</code>
|
||||
*/
|
||||
public static mineplex.database.routines.Check_clans_daily callCheckClansDaily(org.jooq.Configuration configuration, java.lang.Integer accountId_in, java.lang.Integer serverId_in, java.lang.Integer goldChange) {
|
||||
mineplex.database.routines.Check_clans_daily p = new mineplex.database.routines.Check_clans_daily();
|
||||
p.setAccountId_in(accountId_in);
|
||||
p.setServerId_in(serverId_in);
|
||||
p.setGoldChange(goldChange);
|
||||
|
||||
p.execute(configuration);
|
||||
return p;
|
||||
}
|
||||
|
||||
/**
|
||||
* Call <code>Account.check_giveaway</code>
|
||||
@ -131,6 +144,19 @@ public class Routines {
|
||||
p.execute(configuration);
|
||||
return p;
|
||||
}
|
||||
|
||||
/**
|
||||
* Call <code>Account.check_clans_vote</code>
|
||||
*/
|
||||
public static mineplex.database.routines.Check_clans_vote callCheckClansVote(org.jooq.Configuration configuration, java.lang.Integer accountId_in, java.lang.Integer serverId_in, java.lang.Integer goldChange) {
|
||||
mineplex.database.routines.Check_clans_vote p = new mineplex.database.routines.Check_clans_vote();
|
||||
p.setAccountId_in(accountId_in);
|
||||
p.setServerId_in(serverId_in);
|
||||
p.setGoldChange(goldChange);
|
||||
|
||||
p.execute(configuration);
|
||||
return p;
|
||||
}
|
||||
|
||||
/**
|
||||
* Call <code>Account.claimThank</code>
|
||||
|
@ -0,0 +1,93 @@
|
||||
/**
|
||||
* This class is generated by jOOQ
|
||||
*/
|
||||
package mineplex.database.routines;
|
||||
|
||||
/**
|
||||
* This class is generated by jOOQ.
|
||||
*/
|
||||
@javax.annotation.Generated(
|
||||
value = {
|
||||
"http://www.jooq.org",
|
||||
"jOOQ version:3.5.2"
|
||||
},
|
||||
comments = "This class is generated by jOOQ"
|
||||
)
|
||||
@java.lang.SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
||||
public class Check_clans_daily extends org.jooq.impl.AbstractRoutine<java.lang.Void> implements java.io.Serializable, java.lang.Cloneable {
|
||||
|
||||
private static final long serialVersionUID = -1266580733;
|
||||
|
||||
/**
|
||||
* The parameter <code>Account.check_clans_daily.accountId_in</code>.
|
||||
*/
|
||||
public static final org.jooq.Parameter<java.lang.Integer> accountId_in = createParameter("accountId_in", org.jooq.impl.SQLDataType.INTEGER, false);
|
||||
|
||||
/**
|
||||
* The parameter <code>Account.check_clans_daily.serverId_in</code>.
|
||||
*/
|
||||
public static final org.jooq.Parameter<java.lang.Integer> serverId_in = createParameter("serverId_in", org.jooq.impl.SQLDataType.INTEGER, false);
|
||||
|
||||
/**
|
||||
* The parameter <code>Account.check_clans_daily.goldChange</code>.
|
||||
*/
|
||||
public static final org.jooq.Parameter<java.lang.Integer> goldChange = createParameter("goldChange", org.jooq.impl.SQLDataType.INTEGER, false);
|
||||
|
||||
/**
|
||||
* The parameter <code>Account.check_clans_daily.pass</code>.
|
||||
*/
|
||||
public static final org.jooq.Parameter<java.lang.Byte> pass = createParameter("pass", org.jooq.impl.SQLDataType.TINYINT, false);
|
||||
|
||||
/**
|
||||
* The parameter <code>Account.check_clans_daily.outTime</code>.
|
||||
*/
|
||||
public static final org.jooq.Parameter<java.sql.Timestamp> outTime = createParameter("outTime", org.jooq.impl.SQLDataType.TIMESTAMP, false);
|
||||
|
||||
/**
|
||||
* Create a new routine call instance
|
||||
*/
|
||||
public Check_clans_daily() {
|
||||
super("check_clans_daily", mineplex.database.Account.Account);
|
||||
|
||||
addInParameter(accountId_in);
|
||||
addInParameter(serverId_in);
|
||||
addInParameter(goldChange);
|
||||
addOutParameter(pass);
|
||||
addOutParameter(outTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the <code>accountId_in</code> parameter IN value to the routine
|
||||
*/
|
||||
public void setAccountId_in(java.lang.Integer value) {
|
||||
setValue(mineplex.database.routines.Check_clans_daily.accountId_in, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the <code>serverId_in</code> parameter IN value to the routine
|
||||
*/
|
||||
public void setServerId_in(java.lang.Integer value) {
|
||||
setValue(mineplex.database.routines.Check_clans_daily.serverId_in, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the <code>goldChange</code> parameter IN value to the routine
|
||||
*/
|
||||
public void setGoldChange(java.lang.Integer value) {
|
||||
setValue(mineplex.database.routines.Check_clans_daily.goldChange, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the <code>pass</code> parameter OUT value from the routine
|
||||
*/
|
||||
public java.lang.Byte getPass() {
|
||||
return getValue(pass);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the <code>outTime</code> parameter OUT value from the routine
|
||||
*/
|
||||
public java.sql.Timestamp getOutTime() {
|
||||
return getValue(outTime);
|
||||
}
|
||||
}
|
@ -0,0 +1,93 @@
|
||||
/**
|
||||
* This class is generated by jOOQ
|
||||
*/
|
||||
package mineplex.database.routines;
|
||||
|
||||
/**
|
||||
* This class is generated by jOOQ.
|
||||
*/
|
||||
@javax.annotation.Generated(
|
||||
value = {
|
||||
"http://www.jooq.org",
|
||||
"jOOQ version:3.5.2"
|
||||
},
|
||||
comments = "This class is generated by jOOQ"
|
||||
)
|
||||
@java.lang.SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
||||
public class Check_clans_vote extends org.jooq.impl.AbstractRoutine<java.lang.Void> implements java.io.Serializable, java.lang.Cloneable {
|
||||
|
||||
private static final long serialVersionUID = 2035299030;
|
||||
|
||||
/**
|
||||
* The parameter <code>Account.check_clans_vote.accountId_in</code>.
|
||||
*/
|
||||
public static final org.jooq.Parameter<java.lang.Integer> accountId_in = createParameter("accountId_in", org.jooq.impl.SQLDataType.INTEGER, false);
|
||||
|
||||
/**
|
||||
* The parameter <code>Account.check_clans_vote.serverId_in</code>.
|
||||
*/
|
||||
public static final org.jooq.Parameter<java.lang.Integer> serverId_in = createParameter("serverId_in", org.jooq.impl.SQLDataType.INTEGER, false);
|
||||
|
||||
/**
|
||||
* The parameter <code>Account.check_clans_vote.goldChange</code>.
|
||||
*/
|
||||
public static final org.jooq.Parameter<java.lang.Integer> goldChange = createParameter("goldChange", org.jooq.impl.SQLDataType.INTEGER, false);
|
||||
|
||||
/**
|
||||
* The parameter <code>Account.check_clans_vote.pass</code>.
|
||||
*/
|
||||
public static final org.jooq.Parameter<java.lang.Byte> pass = createParameter("pass", org.jooq.impl.SQLDataType.TINYINT, false);
|
||||
|
||||
/**
|
||||
* The parameter <code>Account.check_clans_vote.outTime</code>.
|
||||
*/
|
||||
public static final org.jooq.Parameter<java.sql.Date> outTime = createParameter("outTime", org.jooq.impl.SQLDataType.DATE, false);
|
||||
|
||||
/**
|
||||
* Create a new routine call instance
|
||||
*/
|
||||
public Check_clans_vote() {
|
||||
super("check_clans_vote", mineplex.database.Account.Account);
|
||||
|
||||
addInParameter(accountId_in);
|
||||
addInParameter(serverId_in);
|
||||
addInParameter(goldChange);
|
||||
addOutParameter(pass);
|
||||
addOutParameter(outTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the <code>accountId_in</code> parameter IN value to the routine
|
||||
*/
|
||||
public void setAccountId_in(java.lang.Integer value) {
|
||||
setValue(mineplex.database.routines.Check_clans_daily.accountId_in, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the <code>serverId_in</code> parameter IN value to the routine
|
||||
*/
|
||||
public void setServerId_in(java.lang.Integer value) {
|
||||
setValue(mineplex.database.routines.Check_clans_daily.serverId_in, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the <code>goldChange</code> parameter IN value to the routine
|
||||
*/
|
||||
public void setGoldChange(java.lang.Integer value) {
|
||||
setValue(mineplex.database.routines.Check_clans_daily.goldChange, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the <code>pass</code> parameter OUT value from the routine
|
||||
*/
|
||||
public java.lang.Byte getPass() {
|
||||
return getValue(pass);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the <code>outTime</code> parameter OUT value from the routine
|
||||
*/
|
||||
public java.sql.Date getOutTime() {
|
||||
return getValue(outTime);
|
||||
}
|
||||
}
|
@ -40,6 +40,11 @@ public class Bonus extends org.jooq.impl.TableImpl<mineplex.database.tables.reco
|
||||
* The column <code>Account.bonus.dailytime</code>.
|
||||
*/
|
||||
public final org.jooq.TableField<mineplex.database.tables.records.BonusRecord, java.sql.Timestamp> dailytime = createField("dailytime", org.jooq.impl.SQLDataType.TIMESTAMP, this, "");
|
||||
|
||||
/**
|
||||
* The column <code>Account.bonus.clansdailytime</code>.
|
||||
*/
|
||||
public final org.jooq.TableField<mineplex.database.tables.records.BonusRecord, java.sql.Timestamp> clansdailytime = createField("clansdailytime", org.jooq.impl.SQLDataType.TIMESTAMP, this, "");
|
||||
|
||||
/**
|
||||
* The column <code>Account.bonus.ranktime</code>.
|
||||
@ -50,6 +55,11 @@ public class Bonus extends org.jooq.impl.TableImpl<mineplex.database.tables.reco
|
||||
* The column <code>Account.bonus.votetime</code>.
|
||||
*/
|
||||
public final org.jooq.TableField<mineplex.database.tables.records.BonusRecord, java.sql.Date> votetime = createField("votetime", org.jooq.impl.SQLDataType.DATE, this, "");
|
||||
|
||||
/**
|
||||
* The column <code>Account.bonus.clansvotetime</code>.
|
||||
*/
|
||||
public final org.jooq.TableField<mineplex.database.tables.records.BonusRecord, java.sql.Date> clansvotetime = createField("clansvotetime", org.jooq.impl.SQLDataType.DATE, this, "");
|
||||
|
||||
/**
|
||||
* The column <code>Account.bonus.dailyStreak</code>.
|
||||
|
@ -14,7 +14,7 @@ package mineplex.database.tables.records;
|
||||
comments = "This class is generated by jOOQ"
|
||||
)
|
||||
@java.lang.SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
||||
public class BonusRecord extends org.jooq.impl.UpdatableRecordImpl<mineplex.database.tables.records.BonusRecord> implements java.io.Serializable, java.lang.Cloneable, org.jooq.Record9<java.lang.Integer, java.sql.Timestamp, java.sql.Date, java.sql.Date, java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.Integer> {
|
||||
public class BonusRecord extends org.jooq.impl.UpdatableRecordImpl<mineplex.database.tables.records.BonusRecord> implements java.io.Serializable, java.lang.Cloneable, org.jooq.Record11<java.lang.Integer, java.sql.Timestamp, java.sql.Timestamp, java.sql.Date, java.sql.Date, java.sql.Date, java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.Integer> {
|
||||
|
||||
private static final long serialVersionUID = -785434679;
|
||||
|
||||
@ -45,103 +45,131 @@ public class BonusRecord extends org.jooq.impl.UpdatableRecordImpl<mineplex.data
|
||||
public java.sql.Timestamp getDailytime() {
|
||||
return (java.sql.Timestamp) getValue(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for <code>Account.bonus.clansdailytime</code>.
|
||||
*/
|
||||
public void setClansDailytime(java.sql.Timestamp value) {
|
||||
setValue(2, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for <code>Account.bonus.clansdailytime</code>.
|
||||
*/
|
||||
public java.sql.Timestamp getClansDailytime() {
|
||||
return (java.sql.Timestamp) getValue(2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for <code>Account.bonus.ranktime</code>.
|
||||
*/
|
||||
public void setRanktime(java.sql.Date value) {
|
||||
setValue(2, value);
|
||||
setValue(3, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for <code>Account.bonus.ranktime</code>.
|
||||
*/
|
||||
public java.sql.Date getRanktime() {
|
||||
return (java.sql.Date) getValue(2);
|
||||
return (java.sql.Date) getValue(3);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for <code>Account.bonus.votetime</code>.
|
||||
*/
|
||||
public void setVotetime(java.sql.Date value) {
|
||||
setValue(3, value);
|
||||
setValue(4, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for <code>Account.bonus.votetime</code>.
|
||||
*/
|
||||
public java.sql.Date getVotetime() {
|
||||
return (java.sql.Date) getValue(3);
|
||||
return (java.sql.Date) getValue(4);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for <code>Account.bonus.clansvotetime</code>.
|
||||
*/
|
||||
public void setClansVotetime(java.sql.Date value) {
|
||||
setValue(5, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for <code>Account.bonus.votetime</code>.
|
||||
*/
|
||||
public java.sql.Date getClansVotetime() {
|
||||
return (java.sql.Date) getValue(5);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for <code>Account.bonus.dailyStreak</code>.
|
||||
*/
|
||||
public void setDailyStreak(java.lang.Integer value) {
|
||||
setValue(4, value);
|
||||
setValue(6, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for <code>Account.bonus.dailyStreak</code>.
|
||||
*/
|
||||
public java.lang.Integer getDailyStreak() {
|
||||
return (java.lang.Integer) getValue(4);
|
||||
return (java.lang.Integer) getValue(6);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for <code>Account.bonus.maxDailyStreak</code>.
|
||||
*/
|
||||
public void setMaxDailyStreak(java.lang.Integer value) {
|
||||
setValue(5, value);
|
||||
setValue(7, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for <code>Account.bonus.maxDailyStreak</code>.
|
||||
*/
|
||||
public java.lang.Integer getMaxDailyStreak() {
|
||||
return (java.lang.Integer) getValue(5);
|
||||
return (java.lang.Integer) getValue(7);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for <code>Account.bonus.voteStreak</code>.
|
||||
*/
|
||||
public void setVoteStreak(java.lang.Integer value) {
|
||||
setValue(6, value);
|
||||
setValue(8, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for <code>Account.bonus.voteStreak</code>.
|
||||
*/
|
||||
public java.lang.Integer getVoteStreak() {
|
||||
return (java.lang.Integer) getValue(6);
|
||||
return (java.lang.Integer) getValue(8);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for <code>Account.bonus.maxVoteStreak</code>.
|
||||
*/
|
||||
public void setMaxVoteStreak(java.lang.Integer value) {
|
||||
setValue(7, value);
|
||||
setValue(9, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for <code>Account.bonus.maxVoteStreak</code>.
|
||||
*/
|
||||
public java.lang.Integer getMaxVoteStreak() {
|
||||
return (java.lang.Integer) getValue(7);
|
||||
return (java.lang.Integer) getValue(9);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for <code>Account.bonus.tickets</code>.
|
||||
*/
|
||||
public void setTickets(java.lang.Integer value) {
|
||||
setValue(8, value);
|
||||
setValue(10, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for <code>Account.bonus.tickets</code>.
|
||||
*/
|
||||
public java.lang.Integer getTickets() {
|
||||
return (java.lang.Integer) getValue(8);
|
||||
return (java.lang.Integer) getValue(10);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
@ -164,16 +192,16 @@ public class BonusRecord extends org.jooq.impl.UpdatableRecordImpl<mineplex.data
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public org.jooq.Row9<java.lang.Integer, java.sql.Timestamp, java.sql.Date, java.sql.Date, java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.Integer> fieldsRow() {
|
||||
return (org.jooq.Row9) super.fieldsRow();
|
||||
public org.jooq.Row11<java.lang.Integer, java.sql.Timestamp, java.sql.Timestamp, java.sql.Date, java.sql.Date, java.sql.Date, java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.Integer> fieldsRow() {
|
||||
return (org.jooq.Row11) super.fieldsRow();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public org.jooq.Row9<java.lang.Integer, java.sql.Timestamp, java.sql.Date, java.sql.Date, java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.Integer> valuesRow() {
|
||||
return (org.jooq.Row9) super.valuesRow();
|
||||
public org.jooq.Row11<java.lang.Integer, java.sql.Timestamp, java.sql.Timestamp, java.sql.Date, java.sql.Date, java.sql.Date, java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.Integer> valuesRow() {
|
||||
return (org.jooq.Row11) super.valuesRow();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -191,13 +219,13 @@ public class BonusRecord extends org.jooq.impl.UpdatableRecordImpl<mineplex.data
|
||||
public org.jooq.Field<java.sql.Timestamp> field2() {
|
||||
return mineplex.database.tables.Bonus.bonus.dailytime;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public org.jooq.Field<java.sql.Date> field3() {
|
||||
return mineplex.database.tables.Bonus.bonus.ranktime;
|
||||
public org.jooq.Field<java.sql.Timestamp> field3() {
|
||||
return mineplex.database.tables.Bonus.bonus.clansdailytime;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -205,23 +233,23 @@ public class BonusRecord extends org.jooq.impl.UpdatableRecordImpl<mineplex.data
|
||||
*/
|
||||
@Override
|
||||
public org.jooq.Field<java.sql.Date> field4() {
|
||||
return mineplex.database.tables.Bonus.bonus.ranktime;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public org.jooq.Field<java.sql.Date> field5() {
|
||||
return mineplex.database.tables.Bonus.bonus.votetime;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public org.jooq.Field<java.lang.Integer> field5() {
|
||||
return mineplex.database.tables.Bonus.bonus.dailyStreak;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public org.jooq.Field<java.lang.Integer> field6() {
|
||||
return mineplex.database.tables.Bonus.bonus.maxDailyStreak;
|
||||
public org.jooq.Field<java.sql.Date> field6() {
|
||||
return mineplex.database.tables.Bonus.bonus.clansvotetime;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -229,7 +257,7 @@ public class BonusRecord extends org.jooq.impl.UpdatableRecordImpl<mineplex.data
|
||||
*/
|
||||
@Override
|
||||
public org.jooq.Field<java.lang.Integer> field7() {
|
||||
return mineplex.database.tables.Bonus.bonus.voteStreak;
|
||||
return mineplex.database.tables.Bonus.bonus.dailyStreak;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -237,7 +265,7 @@ public class BonusRecord extends org.jooq.impl.UpdatableRecordImpl<mineplex.data
|
||||
*/
|
||||
@Override
|
||||
public org.jooq.Field<java.lang.Integer> field8() {
|
||||
return mineplex.database.tables.Bonus.bonus.maxVoteStreak;
|
||||
return mineplex.database.tables.Bonus.bonus.maxDailyStreak;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -245,6 +273,22 @@ public class BonusRecord extends org.jooq.impl.UpdatableRecordImpl<mineplex.data
|
||||
*/
|
||||
@Override
|
||||
public org.jooq.Field<java.lang.Integer> field9() {
|
||||
return mineplex.database.tables.Bonus.bonus.voteStreak;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public org.jooq.Field<java.lang.Integer> field10() {
|
||||
return mineplex.database.tables.Bonus.bonus.maxVoteStreak;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public org.jooq.Field<java.lang.Integer> field11() {
|
||||
return mineplex.database.tables.Bonus.bonus.tickets;
|
||||
}
|
||||
|
||||
@ -263,13 +307,13 @@ public class BonusRecord extends org.jooq.impl.UpdatableRecordImpl<mineplex.data
|
||||
public java.sql.Timestamp value2() {
|
||||
return getDailytime();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public java.sql.Date value3() {
|
||||
return getRanktime();
|
||||
public java.sql.Timestamp value3() {
|
||||
return getClansDailytime();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -277,23 +321,23 @@ public class BonusRecord extends org.jooq.impl.UpdatableRecordImpl<mineplex.data
|
||||
*/
|
||||
@Override
|
||||
public java.sql.Date value4() {
|
||||
return getRanktime();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public java.sql.Date value5() {
|
||||
return getVotetime();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public java.lang.Integer value5() {
|
||||
return getDailyStreak();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public java.lang.Integer value6() {
|
||||
return getMaxDailyStreak();
|
||||
public java.sql.Date value6() {
|
||||
return getClansVotetime();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -301,7 +345,7 @@ public class BonusRecord extends org.jooq.impl.UpdatableRecordImpl<mineplex.data
|
||||
*/
|
||||
@Override
|
||||
public java.lang.Integer value7() {
|
||||
return getVoteStreak();
|
||||
return getDailyStreak();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -309,7 +353,7 @@ public class BonusRecord extends org.jooq.impl.UpdatableRecordImpl<mineplex.data
|
||||
*/
|
||||
@Override
|
||||
public java.lang.Integer value8() {
|
||||
return getMaxVoteStreak();
|
||||
return getMaxDailyStreak();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -317,6 +361,22 @@ public class BonusRecord extends org.jooq.impl.UpdatableRecordImpl<mineplex.data
|
||||
*/
|
||||
@Override
|
||||
public java.lang.Integer value9() {
|
||||
return getVoteStreak();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public java.lang.Integer value10() {
|
||||
return getMaxVoteStreak();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public java.lang.Integer value11() {
|
||||
return getTickets();
|
||||
}
|
||||
|
||||
@ -337,13 +397,13 @@ public class BonusRecord extends org.jooq.impl.UpdatableRecordImpl<mineplex.data
|
||||
setDailytime(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public BonusRecord value3(java.sql.Date value) {
|
||||
setRanktime(value);
|
||||
public BonusRecord value3(java.sql.Timestamp value) {
|
||||
setClansDailytime(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -352,25 +412,25 @@ public class BonusRecord extends org.jooq.impl.UpdatableRecordImpl<mineplex.data
|
||||
*/
|
||||
@Override
|
||||
public BonusRecord value4(java.sql.Date value) {
|
||||
setRanktime(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public BonusRecord value5(java.sql.Date value) {
|
||||
setVotetime(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public BonusRecord value5(java.lang.Integer value) {
|
||||
setDailyStreak(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public BonusRecord value6(java.lang.Integer value) {
|
||||
setMaxDailyStreak(value);
|
||||
public BonusRecord value6(java.sql.Date value) {
|
||||
setClansVotetime(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -379,7 +439,7 @@ public class BonusRecord extends org.jooq.impl.UpdatableRecordImpl<mineplex.data
|
||||
*/
|
||||
@Override
|
||||
public BonusRecord value7(java.lang.Integer value) {
|
||||
setVoteStreak(value);
|
||||
setDailyStreak(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -388,7 +448,7 @@ public class BonusRecord extends org.jooq.impl.UpdatableRecordImpl<mineplex.data
|
||||
*/
|
||||
@Override
|
||||
public BonusRecord value8(java.lang.Integer value) {
|
||||
setMaxVoteStreak(value);
|
||||
setMaxDailyStreak(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -397,6 +457,24 @@ public class BonusRecord extends org.jooq.impl.UpdatableRecordImpl<mineplex.data
|
||||
*/
|
||||
@Override
|
||||
public BonusRecord value9(java.lang.Integer value) {
|
||||
setVoteStreak(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public BonusRecord value10(java.lang.Integer value) {
|
||||
setMaxVoteStreak(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public BonusRecord value11(java.lang.Integer value) {
|
||||
setTickets(value);
|
||||
return this;
|
||||
}
|
||||
@ -405,7 +483,7 @@ public class BonusRecord extends org.jooq.impl.UpdatableRecordImpl<mineplex.data
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public BonusRecord values(java.lang.Integer value1, java.sql.Timestamp value2, java.sql.Date value3, java.sql.Date value4, java.lang.Integer value5, java.lang.Integer value6, java.lang.Integer value7, java.lang.Integer value8, java.lang.Integer value9) {
|
||||
public BonusRecord values(java.lang.Integer value1, java.sql.Timestamp value2, java.sql.Timestamp value3, java.sql.Date value4, java.sql.Date value5, java.sql.Date value6, java.lang.Integer value7, java.lang.Integer value8, java.lang.Integer value9, java.lang.Integer value10, java.lang.Integer value11) {
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -423,17 +501,19 @@ public class BonusRecord extends org.jooq.impl.UpdatableRecordImpl<mineplex.data
|
||||
/**
|
||||
* Create a detached, initialised BonusRecord
|
||||
*/
|
||||
public BonusRecord(java.lang.Integer accountId, java.sql.Timestamp dailytime, java.sql.Date ranktime, java.sql.Date votetime, java.lang.Integer dailyStreak, java.lang.Integer maxDailyStreak, java.lang.Integer voteStreak, java.lang.Integer maxVoteStreak, java.lang.Integer tickets) {
|
||||
public BonusRecord(java.lang.Integer accountId, java.sql.Timestamp dailytime, java.sql.Timestamp clansdailytime, java.sql.Date ranktime, java.sql.Date votetime, java.sql.Date clansvotetime, java.lang.Integer dailyStreak, java.lang.Integer maxDailyStreak, java.lang.Integer voteStreak, java.lang.Integer maxVoteStreak, java.lang.Integer tickets) {
|
||||
super(mineplex.database.tables.Bonus.bonus);
|
||||
|
||||
setValue(0, accountId);
|
||||
setValue(1, dailytime);
|
||||
setValue(2, ranktime);
|
||||
setValue(3, votetime);
|
||||
setValue(4, dailyStreak);
|
||||
setValue(5, maxDailyStreak);
|
||||
setValue(6, voteStreak);
|
||||
setValue(7, maxVoteStreak);
|
||||
setValue(8, tickets);
|
||||
setValue(2, clansdailytime);
|
||||
setValue(3, ranktime);
|
||||
setValue(4, votetime);
|
||||
setValue(5, clansvotetime);
|
||||
setValue(6, dailyStreak);
|
||||
setValue(7, maxDailyStreak);
|
||||
setValue(8, voteStreak);
|
||||
setValue(9, maxVoteStreak);
|
||||
setValue(10, tickets);
|
||||
}
|
||||
}
|
||||
|
@ -199,7 +199,7 @@ public class HubManager extends MiniPlugin implements IChatMessageFormatter
|
||||
FacebookManager facebookManager = new FacebookManager(plugin, clientManager, donationManager, inventoryManager);
|
||||
YoutubeManager youtubeManager = new YoutubeManager(plugin, clientManager, donationManager);
|
||||
PlayWireManager playWireManager = new PlayWireManager(plugin, clientManager);
|
||||
_bonusManager = new BonusManager(plugin, null, playWireManager, clientManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager, facebookManager, youtubeManager, _gadgetManager, thankManager);
|
||||
_bonusManager = new BonusManager(plugin, null, playWireManager, clientManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager, facebookManager, youtubeManager, _gadgetManager, thankManager, "Carter");
|
||||
|
||||
World world = _spawn.getWorld();
|
||||
_treasureManager = new TreasureManager(_plugin, clientManager, serverStatusManager, donationManager, _inventoryManager, petManager, _gadgetManager, _blockRestore, hologramManager, statsManager, _bonusManager.getRewardManager());
|
||||
|
@ -227,7 +227,7 @@ public class HubManager extends MiniClientPlugin<HubClient> implements IChatMess
|
||||
YoutubeManager youtubeManager = new YoutubeManager(plugin, clientManager, donationManager);
|
||||
PlayWireManager playWireManager = new PlayWireManager(plugin, clientManager);
|
||||
|
||||
_bonusManager = new BonusManager(plugin, null, playWireManager, clientManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager, facebookManager, youtubeManager, _gadgetManager, thankManager);
|
||||
_bonusManager = new BonusManager(plugin, null, playWireManager, clientManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager, facebookManager, youtubeManager, _gadgetManager, thankManager, "Carl");
|
||||
|
||||
_treasureManager = new TreasureManager(_plugin, clientManager, serverStatusManager, donationManager, _inventoryManager, petManager, _gadgetManager, _blockRestore, hologramManager, statsManager, _bonusManager.getRewardManager());
|
||||
CosmeticManager cosmeticManager = new CosmeticManager(_plugin, clientManager, donationManager, _inventoryManager, _gadgetManager, _mountManager, petManager, _treasureManager, boosterManager);
|
||||
|
@ -1,5 +1,7 @@
|
||||
package mineplex.votifier;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.sql.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
@ -55,6 +57,8 @@ public class VotifierManager extends MiniPlugin
|
||||
private RedisDataRepository<PlayerStatus> _euPlayerRepo;
|
||||
private JedisPool _usWritePool;
|
||||
private JedisPool _euWritePool;
|
||||
|
||||
private final boolean ClansVotifier;
|
||||
|
||||
public VotifierManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, BonusManager bonusManager, InventoryManager inventoryManager, StatsManager statsManager)
|
||||
{
|
||||
@ -76,6 +80,17 @@ public class VotifierManager extends MiniPlugin
|
||||
|
||||
_usWritePool = Utility.generatePool(_usConfig.getConnection(true, "DefaultConnection"));
|
||||
_euWritePool = Utility.generatePool(_euConfig.getConnection(true, "DefaultConnection"));
|
||||
|
||||
boolean found = false;
|
||||
try
|
||||
{
|
||||
found = new File(new File(".").getCanonicalPath() + File.separator + "ClansVotifier.dat").exists();
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
ClansVotifier = found;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -113,7 +128,7 @@ public class VotifierManager extends MiniPlugin
|
||||
awardBonus(playerName, finalUuid, new Callback<Integer>()
|
||||
{
|
||||
@Override
|
||||
public void run(final Integer gems)
|
||||
public void run(final Integer reward)
|
||||
{
|
||||
runSync(new Runnable()
|
||||
{
|
||||
@ -123,13 +138,13 @@ public class VotifierManager extends MiniPlugin
|
||||
if (usStatus != null)
|
||||
{
|
||||
System.out.println("Found " + playerName + " on US " + usStatus.getServer());
|
||||
notifyServer(playerName, gems, Region.US, usStatus.getServer());
|
||||
notifyServer(playerName, reward, Region.US, usStatus.getServer());
|
||||
}
|
||||
|
||||
if (euStatus != null)
|
||||
{
|
||||
System.out.println("Found " + playerName + " on EU " + euStatus.getServer());
|
||||
notifyServer(playerName, gems, Region.EU, euStatus.getServer());
|
||||
notifyServer(playerName, reward, Region.EU, euStatus.getServer());
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -175,11 +190,11 @@ public class VotifierManager extends MiniPlugin
|
||||
// notifyServer(playerName, true);
|
||||
}
|
||||
|
||||
private void notifyServer(String playerName, int gems, Region region, String targetServer)
|
||||
private void notifyServer(String playerName, int reward, Region region, String targetServer)
|
||||
{
|
||||
JedisPool writePool = region == Region.EU ? _euWritePool : _usWritePool;
|
||||
|
||||
VotifierCommand command = new VotifierCommand(playerName, gems, targetServer);
|
||||
VotifierCommand command = new VotifierCommand(playerName, reward, ClansVotifier, targetServer);
|
||||
publishCommand(command, writePool);
|
||||
}
|
||||
|
||||
@ -192,10 +207,14 @@ public class VotifierManager extends MiniPlugin
|
||||
{
|
||||
final int accountId = idRecord.value1();
|
||||
final BonusRecord client = _bonusManager.getRepository().loadRecord(playerName, accountId);
|
||||
final int homeServerId = _bonusManager.getRepository().loadClansServerId(accountId);
|
||||
if (homeServerId == -1 && ClansVotifier)
|
||||
{
|
||||
return;
|
||||
}
|
||||
final BonusAmount amount = ClansVotifier ? _bonusManager.getClansVoteBonusAmount(homeServerId) : _bonusManager.getVoteBonusAmount(client.getVoteStreak());
|
||||
|
||||
final BonusAmount amount = _bonusManager.getVoteBonusAmount(client.getVoteStreak());
|
||||
|
||||
_bonusManager.getRepository().attemptVoteBonus(accountId, new Callback<Pair<Boolean, Date>>()
|
||||
_bonusManager.getRepository().attemptVoteBonus(accountId, ClansVotifier, new Callback<Pair<Boolean, Date>>()
|
||||
{
|
||||
@Override
|
||||
public void run(Pair<Boolean, Date> pair)
|
||||
@ -361,7 +380,7 @@ public class VotifierManager extends MiniPlugin
|
||||
|
||||
client.store();
|
||||
System.out.println("Awarded " + tickets + " carl ticket(s) to " + playerName);
|
||||
onComplete.run(amount.getTotalGems());
|
||||
onComplete.run(ClansVotifier ? amount.getTotalGold() : amount.getTotalGems());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -343,7 +343,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
FacebookManager facebookManager = new FacebookManager(plugin, clientManager, donationManager, inventoryManager);
|
||||
YoutubeManager youtubeManager = new YoutubeManager(plugin, clientManager, donationManager);
|
||||
PlayWireManager playWireManager = new PlayWireManager(plugin, clientManager);
|
||||
_bonusManager = new BonusManager(plugin, _gameLobbyManager.getCarl(), playWireManager, clientManager, donationManager, pollManager, npcManager, hologramManager, statsManager, _inventoryManager, petManager, facebookManager, youtubeManager, _cosmeticManager.getGadgetManager(), thankManager);
|
||||
_bonusManager = new BonusManager(plugin, _gameLobbyManager.getCarl(), playWireManager, clientManager, donationManager, pollManager, npcManager, hologramManager, statsManager, _inventoryManager, petManager, facebookManager, youtubeManager, _cosmeticManager.getGadgetManager(), thankManager, "Carl");
|
||||
|
||||
new GameLootManager(this, petManager, _bonusManager.getRewardManager());
|
||||
_spectatorManager = new GameSpectatorManager(this);
|
||||
|
Loading…
Reference in New Issue
Block a user