Some updates
This commit is contained in:
parent
fd65f27f0f
commit
11e49b9678
@ -38,5 +38,6 @@
|
||||
</value>
|
||||
</option>
|
||||
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
|
||||
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Mineplex" />
|
||||
</component>
|
||||
</project>
|
@ -11,7 +11,6 @@
|
||||
<module fileurl="file://$PROJECT_DIR$/Mineplex.Game.Clans/Mineplex.Game.Clans.iml" filepath="$PROJECT_DIR$/Mineplex.Game.Clans/Mineplex.Game.Clans.iml" group="Game" />
|
||||
<module fileurl="file://$PROJECT_DIR$/Mineplex.Hub/Mineplex.Hub.iml" filepath="$PROJECT_DIR$/Mineplex.Hub/Mineplex.Hub.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/Mineplex.MapParser/Mineplex.MapParser.iml" filepath="$PROJECT_DIR$/Mineplex.MapParser/Mineplex.MapParser.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/Mineplex.Minecraft.BungeeSigns/Mineplex.Minecraft.BungeeSigns.iml" filepath="$PROJECT_DIR$/Mineplex.Minecraft.BungeeSigns/Mineplex.Minecraft.BungeeSigns.iml" group="Bungee" />
|
||||
<module fileurl="file://$PROJECT_DIR$/Mineplex.Minecraft.Game.ClassCombat/Mineplex.Minecraft.Game.ClassCombat.iml" filepath="$PROJECT_DIR$/Mineplex.Minecraft.Game.ClassCombat/Mineplex.Minecraft.Game.ClassCombat.iml" group="Game" />
|
||||
<module fileurl="file://$PROJECT_DIR$/Mineplex.Minecraft.Game.Core/Mineplex.Minecraft.Game.Core.iml" filepath="$PROJECT_DIR$/Mineplex.Minecraft.Game.Core/Mineplex.Minecraft.Game.Core.iml" group="Game" />
|
||||
<module fileurl="file://$PROJECT_DIR$/Mineplex.PlayerCache/Mineplex.PlayerCache.iml" filepath="$PROJECT_DIR$/Mineplex.PlayerCache/Mineplex.PlayerCache.iml" />
|
||||
|
113
Plugins/Mineplex.Hub/src/mineplex/hub/bonuses/BonusAmount.java
Normal file
113
Plugins/Mineplex.Hub/src/mineplex/hub/bonuses/BonusAmount.java
Normal file
@ -0,0 +1,113 @@
|
||||
package mineplex.hub.bonuses;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
|
||||
public class BonusAmount
|
||||
{
|
||||
private int _gems;
|
||||
private int _coins;
|
||||
private int _gold;
|
||||
private int _bonusGems;
|
||||
private int _bonusCoins;
|
||||
private int _bonusGold;
|
||||
|
||||
public BonusAmount()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public int getGems()
|
||||
{
|
||||
return _gems;
|
||||
}
|
||||
|
||||
public void setGems(int gems)
|
||||
{
|
||||
_gems = gems;
|
||||
}
|
||||
|
||||
public int getCoins()
|
||||
{
|
||||
return _coins;
|
||||
}
|
||||
|
||||
public void setCoins(int coins)
|
||||
{
|
||||
_coins = coins;
|
||||
}
|
||||
|
||||
public int getGold()
|
||||
{
|
||||
return _gold;
|
||||
}
|
||||
|
||||
public void setGold(int gold)
|
||||
{
|
||||
_gold = gold;
|
||||
}
|
||||
|
||||
public int getBonusGems()
|
||||
{
|
||||
return _bonusGems;
|
||||
}
|
||||
|
||||
public void setBonusGems(int bonusGems)
|
||||
{
|
||||
_bonusGems = bonusGems;
|
||||
}
|
||||
|
||||
public int getBonusCoins()
|
||||
{
|
||||
return _bonusCoins;
|
||||
}
|
||||
|
||||
public void setBonusCoins(int bonusCoins)
|
||||
{
|
||||
_bonusCoins = bonusCoins;
|
||||
}
|
||||
|
||||
public int getBonusGold()
|
||||
{
|
||||
return _bonusGold;
|
||||
}
|
||||
|
||||
public void setBonusGold(int bonusGold)
|
||||
{
|
||||
_bonusGold = bonusGold;
|
||||
}
|
||||
|
||||
public int getTotalGems()
|
||||
{
|
||||
return getGems() + getBonusCoins();
|
||||
}
|
||||
|
||||
public int getTotalCoins()
|
||||
{
|
||||
return getGems() + getBonusGems();
|
||||
}
|
||||
|
||||
public int getTotalGold()
|
||||
{
|
||||
return getGems() + getBonusGems();
|
||||
}
|
||||
|
||||
public void addLore(List<String> lore)
|
||||
{
|
||||
addLore(lore, getCoins(), getBonusCoins(), "Coins");
|
||||
addLore(lore, getGems(), getBonusGems(), "Gems");
|
||||
addLore(lore, getGold(), getBonusGold(), "Gold");
|
||||
}
|
||||
|
||||
private void addLore(List<String> lore, int amount, int bonus, String suffix)
|
||||
{
|
||||
if (amount > 0)
|
||||
{
|
||||
lore.add(C.cYellow + "Reward " + C.cWhite + amount + " " + suffix);
|
||||
if (bonus > 0)
|
||||
lore.add(C.cYellow + "Streak Bonus " + C.cWhite + bonus + " " + suffix);
|
||||
lore.add(" ");
|
||||
}
|
||||
}
|
||||
}
|
@ -163,22 +163,30 @@ public class BonusManager extends MiniDbClientPlugin<BonusClientData> {
|
||||
return calendar.getTimeInMillis();
|
||||
}
|
||||
|
||||
public int getRankBonusAmount(Player player)
|
||||
public BonusAmount getRankBonusAmount(Player player)
|
||||
{
|
||||
Rank rank = getClientManager().Get(player).GetRank();
|
||||
|
||||
if (rank.Has(Rank.LEGEND)) {
|
||||
return 30000;
|
||||
BonusClientData client = Get(player);
|
||||
double multiplyer = 0.25; // TODO
|
||||
|
||||
BonusAmount data = new BonusAmount();
|
||||
|
||||
if (rank.Has(Rank.LEGEND))
|
||||
{
|
||||
data.setCoins(10000);
|
||||
}
|
||||
else if (rank.Has(Rank.ULTRA))
|
||||
{
|
||||
data.setCoins(7500);
|
||||
}
|
||||
else if (rank.Has(Rank.HERO))
|
||||
{
|
||||
data.setCoins(1500);
|
||||
}
|
||||
|
||||
switch (rank) {
|
||||
case ULTRA:
|
||||
return 7500;
|
||||
case HERO:
|
||||
return 15000;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
data.setBonusCoins((int) (multiplyer * data.getCoins()));
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,7 +1,9 @@
|
||||
package mineplex.hub.bonuses.gui.buttons;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
@ -11,8 +13,11 @@ import mineplex.core.gui.ItemRefresher;
|
||||
import mineplex.core.gui.pages.LoadingWindow;
|
||||
import mineplex.core.gui.pages.TimedMessageWindow;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.shop.item.ShopItem;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.hub.bonuses.BonusAmount;
|
||||
import mineplex.hub.bonuses.BonusClientData;
|
||||
import mineplex.hub.bonuses.BonusManager;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
@ -78,7 +83,7 @@ public class RankBonusButton implements GuiItem, Listener {
|
||||
{
|
||||
if (isAvailable()) {
|
||||
_item = ItemStackFactory.Instance.CreateStack(Material.LAPIS_BLOCK, (byte)0, 1, ChatColor.BLUE + "Processing...");
|
||||
refreashItem();
|
||||
refreshItem();
|
||||
new LoadingWindow(getPlugin(), getPlayer(), 6*9);
|
||||
_bonusManager.attemptRankBonus(getPlayer(), new Consumer<Boolean>()
|
||||
{
|
||||
@ -132,25 +137,59 @@ public class RankBonusButton implements GuiItem, Listener {
|
||||
return _item;
|
||||
}
|
||||
|
||||
public void refreashItem() {
|
||||
public void refreshItem() {
|
||||
getGui().refreshItem(this);
|
||||
}
|
||||
|
||||
public void setItem()
|
||||
{
|
||||
ArrayList<String> lore = new ArrayList<String>;
|
||||
Material material;
|
||||
String itemName;
|
||||
byte data = 0;
|
||||
|
||||
|
||||
if (!hasRank)
|
||||
{
|
||||
material = Material.COAL_BLOCK;
|
||||
itemName = ChatColor.RED + "Players with a Rank can Collect Daily Rewards";
|
||||
lore.add(" ");
|
||||
lore.add(ChatColor.WHITE + "Purchase rank at mineplex.com/shop");
|
||||
|
||||
_item = ItemStackFactory.Instance.CreateStack(Material.COAL_BLOCK, (byte) 0, 1, ChatColor.YELLOW + "Buy rank plz!");
|
||||
}
|
||||
else if (isAvailable())
|
||||
{
|
||||
_item = ItemStackFactory.Instance.CreateStack(Material.ENDER_CHEST, (byte) 0, 1, ChatColor.GREEN + "Click to collect rank bonus!");
|
||||
}
|
||||
else
|
||||
{
|
||||
_item = ItemStackFactory.Instance.CreateStack(Material.REDSTONE_BLOCK, (byte) 0, 1, ChatColor.RED + "Next Rank bonus in:", new String[] {ChatColor.WHITE + UtilTime.convertString(timeLeft(), 0, TimeUnit.FIT) });
|
||||
if (isAvailable())
|
||||
{
|
||||
material = Material.ENDER_CHEST;
|
||||
itemName = C.cGreen + C.Bold + "Click to Claim!";
|
||||
}
|
||||
else
|
||||
{
|
||||
material = Material.REDSTONE_BLOCK;
|
||||
itemName = C.cRed + C.Bold + "Next reward in " + UtilTime.convertString(timeLeft(), 0, TimeUnit.FIT) + "!";
|
||||
}
|
||||
|
||||
lore.add(" ");
|
||||
|
||||
BonusClientData client = _bonusManager.Get(_player);
|
||||
|
||||
BonusAmount bonusAmount = _bonusManager.getRankBonusAmount(_player);
|
||||
bonusAmount.addLore(lore);
|
||||
|
||||
lore.add(C.cYellow + "Current Streak " + C.cWhite + client.getRankStreak());
|
||||
lore.add(C.cYellow + "Highest Streak " + C.cWhite + client.getMaxRankStreak());
|
||||
lore.add(" ");
|
||||
lore.add(C.cYellow + "Record Holder " + C.cWhite + "Phinary");
|
||||
lore.add(C.cYellow + "Streak " + C.cWhite + "420");
|
||||
|
||||
_item = ItemStackFactory.Instance.CreateStack(Material.ENDER_CHEST, (byte) 0, 1, ChatColor.GREEN + "Click to collect rank bonus!");
|
||||
}
|
||||
refreashItem();
|
||||
|
||||
_item = new ShopItem(material, itemName, lore.toArray(new String[0]), 1, false, false);
|
||||
|
||||
refreshItem();
|
||||
}
|
||||
|
||||
public long timeLeft()
|
||||
|
Loading…
Reference in New Issue
Block a user