Convert all possible gem vote rewards to treasure shard vote rewards to comply with Mojang EULA

This commit is contained in:
AlexTheCoder 2016-07-13 08:50:13 -04:00 committed by cnr
parent 7df228a8fa
commit 9c3aee6373
7 changed files with 105 additions and 82 deletions

View File

@ -277,7 +277,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
// return _voteStreak;
// }
public void handleVote(final Player player, final int gemsReceived)
public void handleVote(final Player player, final int shardsReceived)
{
final int accountId = _clientManager.getAccountId(player);
@ -303,7 +303,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
_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") + "!"));
UtilPlayer.message(player, F.main("Carl", "You received " + F.elem("1 Carl Spinner Ticket") + "!"));
}
});
}
@ -618,16 +618,16 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
BonusClientData client = Get(player);
int streak = client.getDailyStreak();
int multiplyer = Math.min(200, 5 * streak);
if (streak >= 40) multiplyer += (1 * (streak - 40));
return multiplyer;
int multiplier = Math.min(200, 5 * streak);
if (streak >= 40) multiplier += (1 * (streak - 40));
return multiplier;
}
public int getVoteMultiplyer(int streak)
public int getVoteMultiplier(int streak)
{
int multiplyer = Math.min(100, 5 * streak);
if (streak >= 20) multiplyer += (1 * (streak - 40));
return multiplyer;
int multiplier = Math.min(100, 5 * streak);
if (streak >= 20) multiplier += (1 * (streak - 40));
return multiplier;
}
public BonusAmount getDailyBonusAmount(Player player)
@ -656,12 +656,10 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
public BonusAmount getVoteBonusAmount(int voteStreak)
{
double mult = getVoteMultiplyer(voteStreak) / 100.0;
double mult = getVoteMultiplier(voteStreak) / 100.0;
BonusAmount amount = new BonusAmount();
amount.setTickets(1);
amount.setGems(400);
amount.setBonusGems((int) (mult * 400));
return amount;
}
@ -1200,4 +1198,4 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
{
return _boosterManager;
}
}
}

View File

@ -129,7 +129,7 @@ public class VoteButton implements GuiItem, Listener {
lore.add(" ");
lore.add(C.cYellow + "Current Streak: " + C.cWhite + client.getVoteStreak());
lore.add(C.cYellow + "Streak Bonus: " + C.cWhite + "+" + _bonusManager.getVoteMultiplyer(client.getVoteStreak()) + "%");
lore.add(C.cYellow + "Streak Bonus: " + C.cWhite + "+" + _bonusManager.getVoteMultiplier(client.getVoteStreak()) + "%");
if (client.getVoteTime() != null)
{
long lastBonus = _bonusManager.getLocalTime(client.getVoteTime().getTime());

View File

@ -25,7 +25,7 @@ public class VoteHandler implements CommandCallback
if (player != null)
{
_bonusManager.handleVote(player, v.getGemsReceived());
_bonusManager.handleVote(player, v.getShardsReceived());
}
}
}

View File

@ -5,14 +5,14 @@ import mineplex.serverdata.commands.ServerCommand;
public class VotifierCommand extends ServerCommand
{
private String _playerName;
private int _gemsReceived;
private int _shardsReceived;
public VotifierCommand(String playerName, int gemsReceived, String... targetServer)
public VotifierCommand(String playerName, int shardsReceived, String... targetServer)
{
super(targetServer);
_playerName = playerName;
_gemsReceived = gemsReceived;
_shardsReceived = shardsReceived;
}
public String getPlayerName()
@ -20,9 +20,9 @@ public class VotifierCommand extends ServerCommand
return _playerName;
}
public int getGemsReceived()
public int getShardsReceived()
{
return _gemsReceived;
return _shardsReceived;
}
}

View File

@ -5,62 +5,44 @@ import java.util.EnumMap;
import java.util.List;
import java.util.Random;
import mineplex.core.common.util.banner.CountryFlag;
import mineplex.core.gadget.gadgets.arrowtrail.freedom.ArrowTrailFreedom;
import mineplex.core.gadget.gadgets.death.freedom.DeathFreedom;
import mineplex.core.gadget.gadgets.doublejump.freedom.DoubleJumpFreedom;
import mineplex.core.gadget.gadgets.hat.*;
import mineplex.core.gadget.gadgets.morph.*;
import mineplex.core.gadget.gadgets.particle.*;
import mineplex.core.gadget.gadgets.particle.candycane.ParticleCandyCane;
import mineplex.core.gadget.gadgets.particle.cupidslove.ParticleHeart;
import mineplex.core.gadget.gadgets.particle.emerald.ParticleEmerald;
import mineplex.core.gadget.gadgets.particle.freedom.ParticleFreedom;
import mineplex.core.gadget.gadgets.particle.frostlord.ParticleFrostLord;
import mineplex.core.gadget.gadgets.particle.howlingwinds.ParticleRain;
import mineplex.core.gadget.gadgets.particle.music.ParticleMusic;
import mineplex.core.gadget.gadgets.particle.party.ParticlePartyTime;
import mineplex.core.gadget.gadgets.particle.shadow.ParticleFoot;
import mineplex.core.gadget.gadgets.particle.vampire.ParticleBlood;
import mineplex.core.gadget.gadgets.particle.wisdom.ParticleEnchant;
import mineplex.core.mount.types.*;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.Rank;
import mineplex.core.common.util.banner.CountryFlag;
import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.gadgets.arrowtrail.vampire.ArrowTrailBlood;
import mineplex.core.gadget.gadgets.arrowtrail.party.ArrowTrailConfetti;
import mineplex.core.gadget.gadgets.arrowtrail.cupidslove.ArrowTrailCupid;
import mineplex.core.gadget.gadgets.arrowtrail.emerald.ArrowTrailEmerald;
import mineplex.core.gadget.gadgets.arrowtrail.wisdom.ArrowTrailEnchant;
import mineplex.core.gadget.gadgets.arrowtrail.freedom.ArrowTrailFreedom;
import mineplex.core.gadget.gadgets.arrowtrail.frostlord.ArrowTrailFrostLord;
import mineplex.core.gadget.gadgets.arrowtrail.music.ArrowTrailMusic;
import mineplex.core.gadget.gadgets.arrowtrail.shadow.ArrowTrailShadow;
import mineplex.core.gadget.gadgets.arrowtrail.howlingwinds.ArrowTrailStorm;
import mineplex.core.gadget.gadgets.death.vampire.DeathBlood;
import mineplex.core.gadget.gadgets.arrowtrail.music.ArrowTrailMusic;
import mineplex.core.gadget.gadgets.arrowtrail.party.ArrowTrailConfetti;
import mineplex.core.gadget.gadgets.arrowtrail.shadow.ArrowTrailShadow;
import mineplex.core.gadget.gadgets.arrowtrail.vampire.ArrowTrailBlood;
import mineplex.core.gadget.gadgets.arrowtrail.wisdom.ArrowTrailEnchant;
import mineplex.core.gadget.gadgets.death.candycane.DeathCandyCane;
import mineplex.core.gadget.gadgets.death.cupidslove.DeathCupidsBrokenHeart;
import mineplex.core.gadget.gadgets.death.emerald.DeathEmerald;
import mineplex.core.gadget.gadgets.death.wisdom.DeathEnchant;
import mineplex.core.gadget.gadgets.death.freedom.DeathFreedom;
import mineplex.core.gadget.gadgets.death.frostlord.DeathFrostLord;
import mineplex.core.gadget.gadgets.death.howlingwinds.DeathStorm;
import mineplex.core.gadget.gadgets.death.music.DeathMusic;
import mineplex.core.gadget.gadgets.death.party.DeathPinataBurst;
import mineplex.core.gadget.gadgets.death.shadow.DeathShadow;
import mineplex.core.gadget.gadgets.death.howlingwinds.DeathStorm;
import mineplex.core.gadget.gadgets.doublejump.vampire.DoubleJumpBlood;
import mineplex.core.gadget.gadgets.death.vampire.DeathBlood;
import mineplex.core.gadget.gadgets.death.wisdom.DeathEnchant;
import mineplex.core.gadget.gadgets.doublejump.cupidslove.DoubleJumpCupidsWings;
import mineplex.core.gadget.gadgets.doublejump.emerald.DoubleJumpEmerald;
import mineplex.core.gadget.gadgets.doublejump.wisdom.DoubleJumpEnchant;
import mineplex.core.gadget.gadgets.doublejump.party.DoubleJumpFirecracker;
import mineplex.core.gadget.gadgets.doublejump.freedom.DoubleJumpFreedom;
import mineplex.core.gadget.gadgets.doublejump.frostlord.DoubleJumpFrostLord;
import mineplex.core.gadget.gadgets.doublejump.music.DoubleJumpMusic;
import mineplex.core.gadget.gadgets.doublejump.shadow.DoubleJumpShadow;
import mineplex.core.gadget.gadgets.doublejump.howlingwinds.DoubleJumpStorm;
import mineplex.core.gadget.gadgets.doublejump.music.DoubleJumpMusic;
import mineplex.core.gadget.gadgets.doublejump.party.DoubleJumpFirecracker;
import mineplex.core.gadget.gadgets.doublejump.shadow.DoubleJumpShadow;
import mineplex.core.gadget.gadgets.doublejump.vampire.DoubleJumpBlood;
import mineplex.core.gadget.gadgets.doublejump.wisdom.DoubleJumpEnchant;
import mineplex.core.gadget.gadgets.gamemodifiers.minestrike.MineStrikeSkin;
import mineplex.core.gadget.gadgets.hat.HatType;
import mineplex.core.gadget.gadgets.item.ItemBatGun;
import mineplex.core.gadget.gadgets.item.ItemBow;
import mineplex.core.gadget.gadgets.item.ItemCoal;
@ -74,6 +56,15 @@ import mineplex.core.gadget.gadgets.item.ItemPaintballGun;
import mineplex.core.gadget.gadgets.item.ItemPartyPopper;
import mineplex.core.gadget.gadgets.item.ItemSnowball;
import mineplex.core.gadget.gadgets.item.ItemTNT;
import mineplex.core.gadget.gadgets.morph.MorphBat;
import mineplex.core.gadget.gadgets.morph.MorphBlock;
import mineplex.core.gadget.gadgets.morph.MorphChicken;
import mineplex.core.gadget.gadgets.morph.MorphCow;
import mineplex.core.gadget.gadgets.morph.MorphEnderman;
import mineplex.core.gadget.gadgets.morph.MorphSlime;
import mineplex.core.gadget.gadgets.morph.MorphSnowman;
import mineplex.core.gadget.gadgets.morph.MorphUncleSam;
import mineplex.core.gadget.gadgets.morph.MorphVillager;
import mineplex.core.gadget.gadgets.outfit.ravesuit.OutfitRaveSuitBoots;
import mineplex.core.gadget.gadgets.outfit.ravesuit.OutfitRaveSuitChestplate;
import mineplex.core.gadget.gadgets.outfit.ravesuit.OutfitRaveSuitHelmet;
@ -82,6 +73,24 @@ import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitBoots;
import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitChestplate;
import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitHelmet;
import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitLeggings;
import mineplex.core.gadget.gadgets.particle.ParticleFairy;
import mineplex.core.gadget.gadgets.particle.ParticleFireRings;
import mineplex.core.gadget.gadgets.particle.ParticleWingsAngel;
import mineplex.core.gadget.gadgets.particle.ParticleWingsDemons;
import mineplex.core.gadget.gadgets.particle.ParticleWingsInfernal;
import mineplex.core.gadget.gadgets.particle.ParticleWingsPixie;
import mineplex.core.gadget.gadgets.particle.ParticleYinYang;
import mineplex.core.gadget.gadgets.particle.candycane.ParticleCandyCane;
import mineplex.core.gadget.gadgets.particle.cupidslove.ParticleHeart;
import mineplex.core.gadget.gadgets.particle.emerald.ParticleEmerald;
import mineplex.core.gadget.gadgets.particle.freedom.ParticleFreedom;
import mineplex.core.gadget.gadgets.particle.frostlord.ParticleFrostLord;
import mineplex.core.gadget.gadgets.particle.howlingwinds.ParticleRain;
import mineplex.core.gadget.gadgets.particle.music.ParticleMusic;
import mineplex.core.gadget.gadgets.particle.party.ParticlePartyTime;
import mineplex.core.gadget.gadgets.particle.shadow.ParticleFoot;
import mineplex.core.gadget.gadgets.particle.vampire.ParticleBlood;
import mineplex.core.gadget.gadgets.particle.wisdom.ParticleEnchant;
import mineplex.core.gadget.gadgets.wineffect.WinEffectBabyChicken;
import mineplex.core.gadget.gadgets.wineffect.WinEffectLavaTrap;
import mineplex.core.gadget.gadgets.wineffect.WinEffectLightningStrike;
@ -93,6 +102,13 @@ import mineplex.core.gadget.types.HatGadget;
import mineplex.core.gadget.types.ItemGadget;
import mineplex.core.inventory.InventoryManager;
import mineplex.core.mount.Mount;
import mineplex.core.mount.types.MountBabyReindeer;
import mineplex.core.mount.types.MountCart;
import mineplex.core.mount.types.MountFreedomHorse;
import mineplex.core.mount.types.MountFrost;
import mineplex.core.mount.types.MountMule;
import mineplex.core.mount.types.MountSlime;
import mineplex.core.mount.types.MountUndead;
import mineplex.core.pet.Pet;
import mineplex.core.pet.PetManager;
import mineplex.core.reward.RewardPool.Type;
@ -105,6 +121,10 @@ import mineplex.core.reward.rewards.TreasureShardReward;
import mineplex.core.reward.rewards.UnknownPackageReward;
import mineplex.core.stats.StatsManager;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
public class RewardManager
{
private EnumMap<RewardPool.Type, RewardPool> _rewardPools;
@ -553,8 +573,7 @@ public class RewardManager
{
RewardRarity rarity = RewardRarity.COMMON;
addReward(Type.CARL_SPINNER, new GemReward(_donationManager, getAmmoMin(rarity), getAmmoMax(rarity), 25, 0, rarity));
addReward(Type.CARL_SPINNER, new ExperienceReward(_statsManager, getAmmoMin(rarity)*5, getAmmoMax(rarity)*5, 25, 0, rarity));
addReward(Type.CARL_SPINNER, new TreasureShardReward(_clientManager, _donationManager, getAmmoMin(rarity), getAmmoMax(rarity), 25, rarity));
//Normal Gadgets
addInventoryReward(Type.NORMAL, getGadget(ItemBatGun.class), rarity, 10, getShards(rarity), 4, 10);
@ -580,8 +599,7 @@ public class RewardManager
{
RewardRarity rarity = RewardRarity.UNCOMMON;
addReward(Type.CARL_SPINNER, new GemReward(_donationManager, getAmmoMin(rarity), getAmmoMax(rarity), 1200, 0, rarity));
addReward(Type.CARL_SPINNER, new ExperienceReward(_statsManager, getAmmoMin(rarity)*5, getAmmoMax(rarity)*5, 1200, 0, rarity));
addReward(Type.CARL_SPINNER, new TreasureShardReward(_clientManager, _donationManager, getAmmoMin(rarity), getAmmoMax(rarity), 1200, rarity));
//Gadgets
addInventoryReward(Type.NORMAL, getGadget(ItemBatGun.class), rarity, 250, 0, 20, 40);
@ -631,8 +649,7 @@ public class RewardManager
{
RewardRarity rarity = RewardRarity.RARE;
addReward(Type.CARL_SPINNER, new GemReward(_donationManager, getAmmoMin(rarity), getAmmoMax(rarity), 150, 0, rarity));
addReward(Type.CARL_SPINNER, new ExperienceReward(_statsManager, getAmmoMin(rarity)*5, getAmmoMax(rarity)*5, 150, 0, rarity));
addReward(Type.CARL_SPINNER, new TreasureShardReward(_clientManager, _donationManager, getAmmoMin(rarity), getAmmoMax(rarity), 150, rarity));
//Morphs
addGadget(Type.NORMAL, getGadget(MorphVillager.class), rarity, 83);
@ -726,8 +743,7 @@ public class RewardManager
{
RewardRarity rarity = RewardRarity.LEGENDARY;
addReward(Type.CARL_SPINNER, new GemReward(_donationManager, getAmmoMin(rarity), getAmmoMax(rarity), 10, 0, rarity));
addReward(Type.CARL_SPINNER, new ExperienceReward(_statsManager, getAmmoMin(rarity)*5, getAmmoMax(rarity)*5, 10, 0, rarity));
addReward(Type.CARL_SPINNER, new TreasureShardReward(_clientManager, _donationManager, getAmmoMin(rarity), getAmmoMax(rarity), 10, rarity));
//REGULAR

View File

@ -4,10 +4,11 @@ import java.util.ArrayList;
import java.util.EnumMap;
import java.util.List;
import org.bukkit.entity.Player;
import mineplex.core.reward.rewards.GemReward;
import mineplex.core.reward.rewards.InventoryReward;
import org.bukkit.entity.Player;
/**
* Used to separate different "Reward Pools". This allows us to have treasure chests with different loot.
*
@ -75,6 +76,13 @@ public class RewardPool
return false;
}
}
if (this == Type.CARL_SPINNER)
{
if (reward instanceof GemReward)
{
return false;
}
}
return true;
}

View File

@ -3,37 +3,38 @@ package mineplex.votifier;
import java.sql.Date;
import java.util.UUID;
import org.bukkit.event.EventHandler;
import org.bukkit.plugin.java.JavaPlugin;
import com.vexsoftware.votifier.model.Vote;
import com.vexsoftware.votifier.model.VotifierEvent;
import mineplex.core.MiniPlugin;
import mineplex.core.account.CoreClientManager;
import mineplex.core.bonuses.BonusAmount;
import mineplex.core.bonuses.BonusManager;
import mineplex.core.bonuses.redis.VotifierCommand;
import mineplex.core.common.Pair;
import mineplex.core.common.util.Callback;
import mineplex.core.common.util.UUIDFetcher;
import mineplex.serverdata.database.DBPool;
import mineplex.core.donation.DonationManager;
import mineplex.core.bonuses.redis.VotifierCommand;
import mineplex.database.Tables;
import mineplex.database.tables.records.BonusRecord;
import mineplex.serverdata.Region;
import mineplex.serverdata.Utility;
import mineplex.serverdata.commands.ServerCommand;
import mineplex.serverdata.data.PlayerStatus;
import mineplex.serverdata.database.DBPool;
import mineplex.serverdata.redis.RedisConfig;
import mineplex.serverdata.redis.RedisDataRepository;
import mineplex.serverdata.servers.ServerManager;
import org.bukkit.event.EventHandler;
import org.bukkit.plugin.java.JavaPlugin;
import org.jooq.DSLContext;
import org.jooq.Record1;
import org.jooq.SQLDialect;
import org.jooq.impl.DSL;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.exceptions.JedisConnectionException;
import com.vexsoftware.votifier.model.Vote;
import com.vexsoftware.votifier.model.VotifierEvent;
/**
* Created by shaun on 15-08-05.
@ -106,7 +107,7 @@ public class VotifierManager extends MiniPlugin
awardBonus(playerName, finalUuid, new Callback<Integer>()
{
@Override
public void run(final Integer gems)
public void run(final Integer shards)
{
runSync(new Runnable()
{
@ -116,13 +117,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, shards, 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, shards, Region.EU, euStatus.getServer());
}
}
});
@ -168,11 +169,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 shards, Region region, String targetServer)
{
JedisPool writePool = region == Region.EU ? _euWritePool : _usWritePool;
VotifierCommand command = new VotifierCommand(playerName, gems, targetServer);
VotifierCommand command = new VotifierCommand(playerName, shards, targetServer);
publishCommand(command, writePool);
}
@ -222,9 +223,9 @@ public class VotifierManager extends MiniPlugin
public void run(Boolean data)
{
if (data)
System.out.println("Gave " + amount.getGems() + " coins to " + playerName);
System.out.println("Gave " + amount.getCoins() + " coins to " + playerName);
else
System.out.println("Failed to give " + amount.getGems() + " coins to " + playerName);
System.out.println("Failed to give " + amount.getCoins() + " coins to " + playerName);
}
}, "Votifier", playerName, accountId, amount.getTotalCoins());
}
@ -238,7 +239,7 @@ public class VotifierManager extends MiniPlugin
client.store();
System.out.println("Awarded carl ticket to " + playerName);
onComplete.run(amount.getTotalGems());
onComplete.run(amount.getTotalCoins());
}
else
{