Merge remote-tracking branch 'refs/remotes/origin/develop' into update/uhc-moppletop
This commit is contained in:
commit
325c0ab56c
@ -32,6 +32,7 @@ public enum Rank
|
||||
TWITCH("Twitch", ChatColor.DARK_PURPLE, "A Twitch streamer who often features \nMineplex in their streams."),
|
||||
|
||||
//Player
|
||||
ETERNAL("Eternal", ChatColor.LIGHT_PURPLE, true, "???"),
|
||||
TITAN("Titan", ChatColor.RED, true, "Ancient myths spoke of a gigantic being \nwith immense power... \n\nPurchase Titan at www.mineplex.com/shop"),
|
||||
LEGEND("Legend", ChatColor.GREEN, true, "Mineplex's third premium rank. \n\nPurchase Legend at www.mineplex.com/shop"),
|
||||
HERO("Hero", ChatColor.LIGHT_PURPLE, true, "There are many stories of a \nvaliant Hero who was brave enough to \ntame the most fearsome dragon in the land. \n\nPurchase Hero at www.mineplex.com/shop"),
|
||||
|
@ -190,7 +190,7 @@ public class AccountRepository extends MinecraftRepository
|
||||
{
|
||||
public void run(final Rank response)
|
||||
{
|
||||
if (rank == Rank.ULTRA || rank == Rank.HERO || rank == Rank.LEGEND || rank == Rank.TITAN)
|
||||
if (rank.isDonor())
|
||||
{
|
||||
if (perm)
|
||||
executeUpdate(UPDATE_ACCOUNT_RANK_DONOR_PERM, new ColumnVarChar("rank", 100, rank.toString()), new ColumnVarChar("donorRank", 100, rank.toString()), new ColumnVarChar("uuid", 100, uuid.toString()));
|
||||
|
@ -47,7 +47,19 @@ public enum AchievementCategory
|
||||
|
||||
UHC("Ultra Hardcore", null,
|
||||
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
|
||||
Material.GOLDEN_APPLE, 0, GameCategory.SURVIVAL, "None", false, GameDisplay.UHC.getGameId()),
|
||||
Material.GOLDEN_APPLE, 0, GameCategory.UHC, "None", false, GameDisplay.UHC.getGameId()),
|
||||
|
||||
UHC_SOLO("Ultra Hardcore Solo", null,
|
||||
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
|
||||
Material.GOLDEN_APPLE, 0, GameCategory.UHC, "None", false, GameDisplay.UHCSolo.getGameId()),
|
||||
|
||||
UHC_SOLO_SPPED("Ultra Hardcore Solo Speed", null,
|
||||
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
|
||||
Material.GOLDEN_APPLE, 0, GameCategory.UHC, "None", false, GameDisplay.UHCSoloSpeed.getGameId()),
|
||||
|
||||
UHC_TEAMS_SPPED("Ultra Hardcore Teams Speed", null,
|
||||
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
|
||||
Material.GOLDEN_APPLE, 0, GameCategory.UHC, "None", false, GameDisplay.UHCTeamsSpeed.getGameId()),
|
||||
|
||||
MC_LEAGUE("MC League", null,
|
||||
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
|
||||
@ -335,6 +347,6 @@ public enum AchievementCategory
|
||||
|
||||
public enum GameCategory
|
||||
{
|
||||
GLOBAL, HOLIDAY, SURVIVAL, CLASSICS, CHAMPIONS, ARCADE
|
||||
GLOBAL, HOLIDAY, SURVIVAL, CLASSICS, CHAMPIONS, ARCADE, UHC
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,46 @@
|
||||
package mineplex.core.achievement.ui.button;
|
||||
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.achievement.AchievementManager;
|
||||
import mineplex.core.achievement.ui.AchievementShop;
|
||||
import mineplex.core.achievement.ui.page.UHCMainPage;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.shop.item.IButton;
|
||||
import mineplex.core.stats.PlayerStats;
|
||||
import mineplex.core.stats.StatsManager;
|
||||
|
||||
public class UHCButton implements IButton
|
||||
{
|
||||
private AchievementShop _shop;
|
||||
private AchievementManager _achievementManager;
|
||||
private StatsManager _statsManager;
|
||||
private DonationManager _donationManager;
|
||||
private CoreClientManager _clientManager;
|
||||
|
||||
private String _targetName;
|
||||
private PlayerStats _targetStats;
|
||||
|
||||
public UHCButton(AchievementShop shop, AchievementManager achievementManager, StatsManager statsManager, DonationManager donationManager, CoreClientManager clientManager, String targetName, PlayerStats targetStats)
|
||||
{
|
||||
_shop = shop;
|
||||
_achievementManager = achievementManager;
|
||||
_statsManager = statsManager;
|
||||
_donationManager = donationManager;
|
||||
_clientManager = clientManager;
|
||||
|
||||
_targetName = targetName;
|
||||
_targetStats = targetStats;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
_shop.openPageForPlayer(player, new UHCMainPage(_achievementManager, _statsManager, _shop, _clientManager, _donationManager, "UHC", player, _targetName, _targetStats));
|
||||
player.playSound(player.getLocation(), Sound.CLICK, 1, 1);
|
||||
}
|
||||
|
||||
}
|
@ -3,7 +3,6 @@ package mineplex.core.achievement.ui.page;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import mineplex.core.stats.PlayerStats;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -16,11 +15,13 @@ import mineplex.core.achievement.AchievementManager;
|
||||
import mineplex.core.achievement.ui.AchievementShop;
|
||||
import mineplex.core.achievement.ui.button.ArcadeButton;
|
||||
import mineplex.core.achievement.ui.button.CategoryButton;
|
||||
import mineplex.core.achievement.ui.button.UHCButton;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.itemstack.ItemLayout;
|
||||
import mineplex.core.shop.item.ShopItem;
|
||||
import mineplex.core.shop.page.ShopPageBase;
|
||||
import mineplex.core.stats.PlayerStats;
|
||||
import mineplex.core.stats.StatsManager;
|
||||
|
||||
public class AchievementMainPage extends ShopPageBase<AchievementManager, AchievementShop>
|
||||
@ -59,7 +60,7 @@ public class AchievementMainPage extends ShopPageBase<AchievementManager, Achiev
|
||||
|
||||
for (AchievementCategory category : AchievementCategory.values())
|
||||
{
|
||||
if (category.getGameCategory() == AchievementCategory.GameCategory.ARCADE)
|
||||
if (category.getGameCategory() == AchievementCategory.GameCategory.ARCADE || category.getGameCategory() == AchievementCategory.GameCategory.UHC)
|
||||
continue;
|
||||
|
||||
CategoryButton button = new CategoryButton(getShop(), getPlugin(), _statsManager, category, getDonationManager(),
|
||||
@ -79,6 +80,7 @@ public class AchievementMainPage extends ShopPageBase<AchievementManager, Achiev
|
||||
}
|
||||
|
||||
addArcadeButton(pageLayout.get(listSlot++));
|
||||
addUHCButton(pageLayout.get(listSlot++));
|
||||
}
|
||||
|
||||
protected void addArcadeButton(int slot)
|
||||
@ -89,6 +91,14 @@ public class AchievementMainPage extends ShopPageBase<AchievementManager, Achiev
|
||||
addButton(slot, shopItem, button);
|
||||
}
|
||||
|
||||
protected void addUHCButton(int slot)
|
||||
{
|
||||
UHCButton button = new UHCButton(getShop(), getPlugin(), _statsManager, getDonationManager(), getClientManager(), _targetName, _targetStats);
|
||||
ShopItem shopItem = new ShopItem(Material.GOLDEN_APPLE, (byte) 0, C.Bold + "UHC", new String[] {" ", ChatColor.RESET + "Click for more!"}, 1, false, false);
|
||||
|
||||
addButton(slot, shopItem, button);
|
||||
}
|
||||
|
||||
protected void addAchievements(AchievementCategory category, List<String> lore, int max)
|
||||
{
|
||||
int achievementCount = 0;
|
||||
|
@ -0,0 +1,71 @@
|
||||
package mineplex.core.achievement.ui.page;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import mineplex.core.stats.PlayerStats;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.achievement.AchievementCategory;
|
||||
import mineplex.core.achievement.AchievementManager;
|
||||
import mineplex.core.achievement.ui.AchievementShop;
|
||||
import mineplex.core.achievement.ui.button.CategoryButton;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.shop.item.IButton;
|
||||
import mineplex.core.shop.item.ShopItem;
|
||||
import mineplex.core.stats.StatsManager;
|
||||
|
||||
public class UHCMainPage extends AchievementMainPage
|
||||
{
|
||||
public UHCMainPage(AchievementManager plugin, StatsManager statsManager, AchievementShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player, String targetName, PlayerStats targetStats)
|
||||
{
|
||||
super(plugin, statsManager, shop, clientManager, donationManager, name, player, 9 * 5, targetName, targetStats);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void buildPage()
|
||||
{
|
||||
int slot = 10;
|
||||
|
||||
for (AchievementCategory category : AchievementCategory.values())
|
||||
{
|
||||
if (category.getGameCategory() != AchievementCategory.GameCategory.UHC)
|
||||
continue;
|
||||
|
||||
CategoryButton button = new CategoryButton(getShop(), getPlugin(), _statsManager, category, getDonationManager(), getClientManager(), _targetName, _targetStats);
|
||||
|
||||
ArrayList<String> lore = new ArrayList<String>();
|
||||
lore.add(" ");
|
||||
category.addStats(getClientManager(), _statsManager, lore, 2, getPlayer(), _targetName, _targetStats);
|
||||
lore.add(" ");
|
||||
addAchievements(category, lore, 9);
|
||||
lore.add(" ");
|
||||
lore.add(ChatColor.RESET + "Click for more details!");
|
||||
|
||||
ShopItem shopItem = new ShopItem(category.getIcon(), category.getIconData(), C.Bold + category.getFriendlyName(), lore.toArray(new String[0]), 1, false, false);
|
||||
addButton(slot, shopItem, button);
|
||||
|
||||
slot += ((slot + 1) % 9 == 0) ? 1 : 2;
|
||||
}
|
||||
|
||||
addBackButton();
|
||||
}
|
||||
|
||||
private void addBackButton()
|
||||
{
|
||||
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton()
|
||||
{
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
getShop().openPageForPlayer(getPlayer(), new AchievementMainPage(getPlugin(), _statsManager, getShop(), getClientManager(), getDonationManager(), _targetName + "'s Stats", player, _targetName, _targetStats));
|
||||
player.playSound(player.getLocation(), Sound.CLICK, 1, 1);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
@ -20,6 +20,8 @@ public class BonusAmount
|
||||
private int _oldChests;
|
||||
private int _ancientChests;
|
||||
private int _mythicalChests;
|
||||
private int _illuminatedChests;
|
||||
private int _omegaChests;
|
||||
|
||||
public BonusAmount()
|
||||
{
|
||||
@ -166,6 +168,26 @@ public class BonusAmount
|
||||
_mythicalChests = mythicalChests;
|
||||
}
|
||||
|
||||
public int getIlluminatedChests()
|
||||
{
|
||||
return _illuminatedChests;
|
||||
}
|
||||
|
||||
public void setIlluminatedChests(int illuminatedChests)
|
||||
{
|
||||
_illuminatedChests = illuminatedChests;
|
||||
}
|
||||
|
||||
public int getOmegaChests()
|
||||
{
|
||||
return _omegaChests;
|
||||
}
|
||||
|
||||
public void setOmegaChests(int omegaChests)
|
||||
{
|
||||
_omegaChests = omegaChests;
|
||||
}
|
||||
|
||||
public boolean isGreaterThanZero()
|
||||
{
|
||||
return _bonusCoins > 0 || _coins > 0 || _bonusGems > 0 || _gems > 0 || _gold > 0 || _bonusGold > 0 || _oldChests > 0 || _ancientChests > 0 || _mythicalChests > 0;
|
||||
@ -182,6 +204,8 @@ public class BonusAmount
|
||||
addLore(lore, getOldChests(), 0, "Old Chest", "Old Chests");
|
||||
addLore(lore, getAncientChests(), 0, "Ancient Chest", "Ancient Chests");
|
||||
addLore(lore, getMythicalChests(), 0, "Mythical Chest", "Mythical Chests");
|
||||
addLore(lore, getIlluminatedChests(), 0, "Illuminated Chest", "Illuminated Chests");
|
||||
addLore(lore, getOmegaChests(), 0, "Omega Chest", "Omega Chests");
|
||||
}
|
||||
|
||||
private void addLore(List<String> lore, int amount, int bonus, String suffix)
|
||||
|
@ -520,7 +520,12 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
|
||||
BonusAmount data = new BonusAmount();
|
||||
|
||||
if (rank.has(Rank.TITAN))
|
||||
if (rank.has(Rank.ETERNAL))
|
||||
{
|
||||
data.setIlluminatedChests(2);
|
||||
data.setMythicalChests(2);
|
||||
data.setOmegaChests(1);
|
||||
} else if (rank.has(Rank.TITAN))
|
||||
{
|
||||
data.setMythicalChests(5);
|
||||
}
|
||||
@ -553,6 +558,8 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
int oldChests = amount.getOldChests();
|
||||
int ancientChests = amount.getAncientChests();
|
||||
int mythicalChests = amount.getMythicalChests();
|
||||
int illuminatedChests = amount.getIlluminatedChests();
|
||||
int omegaChests = amount.getOmegaChests();
|
||||
|
||||
if (oldChests > 0)
|
||||
{
|
||||
@ -572,6 +579,18 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
_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")));
|
||||
_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")));
|
||||
_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")));
|
||||
|
@ -0,0 +1,25 @@
|
||||
package mineplex.core.rankGiveaway.eternal;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.Rank;
|
||||
|
||||
public class EternalCommand extends CommandBase<EternalGiveawayManager>
|
||||
{
|
||||
public EternalCommand(EternalGiveawayManager plugin)
|
||||
{
|
||||
super(plugin, Rank.OWNER, "eternaltest");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
Plugin.attemptToGiveEternal(caller, () ->
|
||||
{
|
||||
Location location = caller.getLocation().add(0.5, 0.5, 0.5);
|
||||
new EternalGiveawayAnimation(Plugin, location, 3000L);
|
||||
});
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package mineplex.core.rankGiveaway.eternal;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.FireworkEffect.Type;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
import mineplex.core.common.util.UtilFirework;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
public class EternalGiveawayAnimation implements Listener
|
||||
{
|
||||
private Location _location;
|
||||
private Long _duration, _startTime, _worldTime;
|
||||
|
||||
public EternalGiveawayAnimation(EternalGiveawayManager manager, Location start, Long duration)
|
||||
{
|
||||
_location = start.clone();
|
||||
_duration = duration;
|
||||
_startTime = System.currentTimeMillis();
|
||||
Bukkit.getPluginManager().registerEvents(this, manager.getPlugin());
|
||||
}
|
||||
|
||||
public EternalGiveawayAnimation(EternalGiveawayManager manager, Location start)
|
||||
{
|
||||
this(manager, start, 11111L);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void tick(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
if (UtilTime.elapsed(_startTime, _duration))
|
||||
{
|
||||
remove();
|
||||
return;
|
||||
}
|
||||
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
{
|
||||
player.playSound(_location, Sound.ORB_PICKUP, 5, 5);
|
||||
UtilFirework.packetPlayFirework(player, _location, Type.BURST, Color.fromRGB(255, 105, 180), true, false);
|
||||
}
|
||||
}
|
||||
|
||||
private void remove()
|
||||
{
|
||||
HandlerList.unregisterAll(this);
|
||||
}
|
||||
}
|
@ -0,0 +1,106 @@
|
||||
package mineplex.core.rankGiveaway.eternal;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.rankGiveaway.redis.EternalGiveawayMessage;
|
||||
import mineplex.core.rankGiveaway.redis.GiveawayMessageHandler;
|
||||
import mineplex.core.status.ServerStatusManager;
|
||||
import mineplex.serverdata.Region;
|
||||
import mineplex.serverdata.commands.ServerCommandManager;
|
||||
|
||||
public class EternalGiveawayManager extends MiniPlugin
|
||||
{
|
||||
|
||||
private static final double RANK_FIND_CHANCE = 0.001;
|
||||
|
||||
private EternalGiveawayRepository _repository;
|
||||
private CoreClientManager _clientManager;
|
||||
private ServerStatusManager _statusManager;
|
||||
private Random _random;
|
||||
|
||||
public EternalGiveawayManager(JavaPlugin plugin, CoreClientManager clientManager, ServerStatusManager statusManager)
|
||||
{
|
||||
super("Eternal Giveaway", plugin);
|
||||
|
||||
_repository = new EternalGiveawayRepository(plugin);
|
||||
_clientManager = clientManager;
|
||||
_statusManager = statusManager;
|
||||
_random = new Random();
|
||||
|
||||
ServerCommandManager.getInstance().registerCommandType("EternalGiveawayMessage", EternalGiveawayMessage.class, new GiveawayMessageHandler(plugin));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCommands()
|
||||
{
|
||||
addCommand(new EternalCommand(this));
|
||||
}
|
||||
|
||||
public void openPumpkin(final Player player, final Runnable onSuccess)
|
||||
{
|
||||
double rand = _random.nextDouble();
|
||||
if (!hasEternal(player) && rand < RANK_FIND_CHANCE)
|
||||
{
|
||||
attemptToGiveEternal(player, onSuccess);
|
||||
}
|
||||
}
|
||||
|
||||
protected void attemptToGiveEternal(Player player, Runnable onSuccess)
|
||||
{
|
||||
final int accountId = _clientManager.getAccountId(player);
|
||||
final Region region = getRegion();
|
||||
final String serverName = getServerName();
|
||||
|
||||
if (accountId == -1) return;
|
||||
|
||||
// Need to check database that we can give away a rank
|
||||
runAsync(() ->
|
||||
{
|
||||
final boolean pass = _repository.canGiveaway(region);
|
||||
|
||||
if (pass && _repository.addEternal(accountId, region, serverName))
|
||||
{
|
||||
runSync(() -> giveRank(rank ->
|
||||
{
|
||||
if (rank == Rank.ETERNAL)
|
||||
{
|
||||
EternalGiveawayMessage message = new EternalGiveawayMessage(player.getName(), _repository.getEternalCount() + 1);
|
||||
message.publish();
|
||||
if (onSuccess != null) onSuccess.run();
|
||||
}
|
||||
}, Rank.ETERNAL, player));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Confirm that the player doesn't already have ETERNAL rank
|
||||
*/
|
||||
private boolean hasEternal(Player player)
|
||||
{
|
||||
return _clientManager.hasRank(player, Rank.ETERNAL);
|
||||
}
|
||||
|
||||
public Region getRegion()
|
||||
{
|
||||
return _statusManager.getRegion();
|
||||
}
|
||||
|
||||
public String getServerName()
|
||||
{
|
||||
return _statusManager.getCurrentServerName();
|
||||
}
|
||||
|
||||
private void giveRank(Callback<Rank> callback, Rank rank, Player player)
|
||||
{
|
||||
_clientManager.Get(player).SetRank(rank, false);
|
||||
_clientManager.getRepository().saveRank(callback, player.getName(), player.getUniqueId(), rank, true);
|
||||
}
|
||||
}
|
@ -0,0 +1,71 @@
|
||||
package mineplex.core.rankGiveaway.eternal;
|
||||
|
||||
import java.sql.CallableStatement;
|
||||
import java.sql.Connection;
|
||||
import java.sql.Types;
|
||||
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.database.MinecraftRepository;
|
||||
import mineplex.serverdata.Region;
|
||||
import mineplex.serverdata.database.DBPool;
|
||||
import mineplex.serverdata.database.column.ColumnInt;
|
||||
import mineplex.serverdata.database.column.ColumnVarChar;
|
||||
|
||||
public class EternalGiveawayRepository extends MinecraftRepository
|
||||
{
|
||||
private static final String ADD_ETERNAL = "INSERT INTO eternalGiveaway (accountId, region, serverName) VALUES (?, ?, ?)";
|
||||
|
||||
private int _eternalCount;
|
||||
|
||||
public EternalGiveawayRepository(JavaPlugin plugin)
|
||||
{
|
||||
super(plugin, DBPool.getAccount());
|
||||
_eternalCount = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initialize()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public boolean addEternal(int accountId, Region region, String serverName)
|
||||
{
|
||||
return 1 == executeUpdate(ADD_ETERNAL, new ColumnInt("accountId", accountId), new ColumnVarChar("region", 10, region.name()), new ColumnVarChar("serverName", 64, serverName));
|
||||
}
|
||||
|
||||
public boolean canGiveaway(Region region)
|
||||
{
|
||||
try (Connection connection = getConnection();
|
||||
CallableStatement callableStatement = connection.prepareCall("{call check_eternalGiveaway(?, ?, ?)}"))
|
||||
{
|
||||
callableStatement.setString(1, region.name());
|
||||
callableStatement.registerOutParameter(2, Types.BOOLEAN);
|
||||
callableStatement.registerOutParameter(3, Types.INTEGER);
|
||||
callableStatement.executeUpdate();
|
||||
|
||||
boolean pass = callableStatement.getBoolean(2);
|
||||
int eternalCount = callableStatement.getInt(3);
|
||||
|
||||
_eternalCount = eternalCount;
|
||||
return pass;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getEternalCount()
|
||||
{
|
||||
return _eternalCount;
|
||||
}
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package mineplex.core.rankGiveaway.redis;
|
||||
|
||||
import mineplex.serverdata.commands.ServerCommand;
|
||||
|
||||
public class EternalGiveawayMessage extends ServerCommand
|
||||
{
|
||||
private String _playerName;
|
||||
private int _eternalCount;
|
||||
|
||||
public EternalGiveawayMessage(String playerName, int eternalCount)
|
||||
{
|
||||
_playerName = playerName;
|
||||
_eternalCount = eternalCount;
|
||||
}
|
||||
|
||||
public String getPlayerName()
|
||||
{
|
||||
return _playerName;
|
||||
}
|
||||
|
||||
public int getEternalCount()
|
||||
{
|
||||
return _eternalCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
// Handled in Command Callback
|
||||
}
|
||||
}
|
||||
|
@ -44,5 +44,22 @@ public class GiveawayMessageHandler implements CommandCallback
|
||||
player.playSound(player.getEyeLocation(), Sound.AMBIENCE_CAVE, 1, 1);
|
||||
}
|
||||
}
|
||||
else if (command instanceof EternalGiveawayMessage)
|
||||
{
|
||||
EternalGiveawayMessage message = ((EternalGiveawayMessage) command);
|
||||
String playerName = message.getPlayerName();
|
||||
int count = message.getEternalCount();
|
||||
String countString = count + UtilTime.getDayOfMonthSuffix(count);
|
||||
String chatMessage = C.cPurple + playerName + C.cWhite + " found Eternal Rank in a " + C.cPurple + "Thanksgiving Chicken";
|
||||
UtilTextMiddle.display(C.cDPurple + C.Bold + "ETERNAL", chatMessage, 20, 80, 20, UtilServer.getPlayers());
|
||||
World world = UtilServer.getPlayers().length > 0 ? UtilServer.getPlayers()[0].getWorld() : Bukkit.getWorlds().get(0);
|
||||
LightFlicker lightFlicker = new LightFlicker(world);
|
||||
lightFlicker.runTaskTimer(_plugin, 1, 1);
|
||||
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
{
|
||||
player.playSound(player.getEyeLocation(), Sound.AMBIENCE_CAVE, 1, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -37,6 +37,7 @@ import mineplex.core.packethandler.PacketHandler;
|
||||
import mineplex.core.portal.Portal;
|
||||
import mineplex.core.preferences.PreferencesManager;
|
||||
import mineplex.core.punish.Punish;
|
||||
import mineplex.core.rankGiveaway.eternal.EternalGiveawayManager;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.report.ReportManager;
|
||||
import mineplex.core.report.ReportPlugin;
|
||||
@ -141,6 +142,8 @@ public class Clans extends JavaPlugin
|
||||
antiHack.setKick(false);
|
||||
Bukkit.getScheduler().runTask(this, antiHack::enableNewAnticheat);
|
||||
|
||||
new EternalGiveawayManager(this, _clientManager, serverStatusManager);
|
||||
|
||||
{
|
||||
// West Shop
|
||||
int maxX = -385;
|
||||
|
@ -37,6 +37,7 @@ import mineplex.core.portal.Portal;
|
||||
import mineplex.core.preferences.PreferencesManager;
|
||||
import mineplex.core.profileCache.ProfileCacheManager;
|
||||
import mineplex.core.punish.Punish;
|
||||
import mineplex.core.rankGiveaway.eternal.EternalGiveawayManager;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.resourcepack.ResourcePackManager;
|
||||
import mineplex.core.serverConfig.ServerConfiguration;
|
||||
@ -157,6 +158,8 @@ public class ClansHub extends JavaPlugin
|
||||
|
||||
AprilFoolsManager.Initialize(this, clientManager, disguiseManager);
|
||||
|
||||
new EternalGiveawayManager(this, clientManager, serverStatusManager);
|
||||
|
||||
CombatManager combatManager = new CombatManager(this);
|
||||
|
||||
DamageManager damage = new DamageManager(this, combatManager, npcManager, disguiseManager, condition);
|
||||
|
@ -50,6 +50,7 @@ import mineplex.core.preferences.PreferencesManager;
|
||||
import mineplex.core.profileCache.ProfileCacheManager;
|
||||
import mineplex.core.projectile.ProjectileManager;
|
||||
import mineplex.core.punish.Punish;
|
||||
import mineplex.core.rankGiveaway.eternal.EternalGiveawayManager;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.report.ReportManager;
|
||||
import mineplex.core.report.ReportPlugin;
|
||||
@ -194,6 +195,8 @@ public class Hub extends JavaPlugin implements IRelation
|
||||
|
||||
AprilFoolsManager.Initialize(this, clientManager, disguiseManager);
|
||||
|
||||
new EternalGiveawayManager(this, clientManager, serverStatusManager);
|
||||
|
||||
CombatManager combatManager = new CombatManager(this);
|
||||
|
||||
|
||||
|
@ -89,6 +89,7 @@ import mineplex.core.preferences.PreferencesManager;
|
||||
import mineplex.core.progression.KitProgressionManager;
|
||||
import mineplex.core.projectile.ProjectileManager;
|
||||
import mineplex.core.punish.Punish;
|
||||
import mineplex.core.rankGiveaway.eternal.EternalGiveawayManager;
|
||||
import mineplex.core.resourcepack.ResourcePackManager;
|
||||
import mineplex.core.scoreboard.MineplexScoreboard;
|
||||
import mineplex.core.scoreboard.ScoreboardManager;
|
||||
@ -342,8 +343,9 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
_hologramManager = hologramManager;
|
||||
_idleManager = new IdleManager(this);
|
||||
TitanGiveawayManager titanGiveaway = new TitanGiveawayManager(getPlugin(), clientManager, serverStatusManager);
|
||||
EternalGiveawayManager eternalGiveawayManager = new EternalGiveawayManager(getPlugin(), clientManager, serverStatusManager);
|
||||
|
||||
new HolidayManager(this, titanGiveaway);
|
||||
new HolidayManager(this, titanGiveaway, eternalGiveawayManager);
|
||||
IsHolidayEnabled = true;
|
||||
|
||||
new ValentinesGiftManager(plugin, clientManager, _bonusManager.getRewardManager(), inventoryManager, _cosmeticManager.getGadgetManager(), statsManager);
|
||||
@ -1696,6 +1698,8 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
}
|
||||
|
||||
public void enableChampionsModules()
|
||||
{
|
||||
if (_registered == null || !_registered)
|
||||
{
|
||||
_classManager.setEnabled(true);
|
||||
_classShopManager.registerSelf();
|
||||
@ -1706,9 +1710,14 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
|
||||
//Class Shop
|
||||
_plugin.getServer().getPluginManager().registerEvents(_classShop, _plugin);
|
||||
|
||||
_registered = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void disableChampionsModules()
|
||||
{
|
||||
if (_registered == null || _registered)
|
||||
{
|
||||
_classManager.setEnabled(false);
|
||||
_classShopManager.deregisterSelf();
|
||||
@ -1719,18 +1728,14 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
|
||||
//Class Shop
|
||||
HandlerList.unregisterAll(_classShop);
|
||||
_registered = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void toggleChampionsModules(GameType gameType)
|
||||
{
|
||||
boolean isChamps = gameType == GameType.ChampionsDominate || gameType == GameType.ChampionsTDM || gameType == GameType.ChampionsCTF || gameType == GameType.BossBattles;
|
||||
|
||||
if (_enabled == isChamps)
|
||||
{
|
||||
System.out.println("----------Champions Modules are still " + isChamps);
|
||||
return;
|
||||
}
|
||||
|
||||
System.out.println("----------Champions Modules set to " + isChamps);
|
||||
_enabled = isChamps;
|
||||
|
||||
|
@ -90,6 +90,7 @@ import nautilus.game.arcade.events.PlayerPrepareTeleportEvent;
|
||||
import nautilus.game.arcade.game.DebugCommand;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.games.AbsorptionFix;
|
||||
import nautilus.game.arcade.game.games.uhc.components.UHCBorder;
|
||||
import nautilus.game.arcade.game.games.uhc.components.UHCFreezer;
|
||||
import nautilus.game.arcade.game.games.uhc.components.UHCSpeedMode;
|
||||
@ -273,6 +274,7 @@ public abstract class UHC extends Game
|
||||
new OreVeinEditorModule().removeNonAirVeins().register(this);
|
||||
new AntiExpOrbModule().register(this);
|
||||
new RejoinModule().register(this);
|
||||
new AbsorptionFix(this);
|
||||
|
||||
registerDebugCommand(new DebugCommand("startpvp", Rank.ADMIN)
|
||||
{
|
||||
|
@ -131,6 +131,8 @@ public class RejoinModule extends Module
|
||||
return;
|
||||
}
|
||||
|
||||
_data.remove(data);
|
||||
|
||||
GameTeam team = data.getTeam();
|
||||
|
||||
// Assume they have been revived
|
||||
@ -146,8 +148,6 @@ public class RejoinModule extends Module
|
||||
{
|
||||
getGame().SetKit(player, data.getKit(), false);
|
||||
}
|
||||
|
||||
_data.remove(data);
|
||||
}
|
||||
|
||||
// Do this on Join, not Login, otherwise player no get heal.
|
||||
|
@ -715,7 +715,7 @@ public class GameHostManager implements Listener
|
||||
|
||||
public int getMaxPlayerCap()
|
||||
{
|
||||
if (hasRank(Rank.SNR_MODERATOR) || _hostRank == Rank.YOUTUBE || _hostRank == Rank.TWITCH)
|
||||
if (hasRank(Rank.SNR_MODERATOR) || _hostRank == Rank.YOUTUBE || _hostRank == Rank.TWITCH || _hostRank == Rank.ETERNAL)
|
||||
return 100;
|
||||
else if (_hostRank == Rank.YOUTUBE_SMALL)
|
||||
return 60;
|
||||
|
@ -231,8 +231,10 @@ public class GameRewardManager implements Listener
|
||||
shardsToReward += baseShardsEarned * 1;
|
||||
else if (rank == rank.LEGEND)
|
||||
shardsToReward += baseShardsEarned * 1.5;
|
||||
else if (rank.has(Rank.TITAN))
|
||||
else if (rank == Rank.TITAN)
|
||||
shardsToReward += baseShardsEarned * 2;
|
||||
else if (rank.has(Rank.ETERNAL))
|
||||
shardsToReward += baseShardsEarned * 2.5;
|
||||
|
||||
Manager.GetDonation().RewardGems(null, "Earned " + game.GetName(), player.getName(), player.getUniqueId(), gemsToReward);
|
||||
if (accountId != -1)
|
||||
|
Loading…
Reference in New Issue
Block a user