- Fixed random weather in MCL

- Added Elo Division display to /stats for applicable games
- Made fishing rods kept on death in MCL
This commit is contained in:
AlexTheCoder 2016-04-27 23:12:38 -04:00
parent a16145479e
commit b4c5be81f3
13 changed files with 210 additions and 146 deletions

View File

@ -6,7 +6,6 @@ import mineplex.core.account.CoreClientManager;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilTime;
import mineplex.core.game.GameCategory;
import mineplex.core.game.GameDisplay;
import mineplex.core.stats.PlayerStats;
import mineplex.core.stats.StatsManager;
@ -20,15 +19,15 @@ public enum AchievementCategory
GLOBAL("Global", null,
new StatDisplay[] { StatDisplay.GEMS_EARNED, null, new StatDisplay("Games Played", "GamesPlayed"), StatDisplay.TIME_IN_GAME, null,
new StatDisplay("Daily Rewards", "DailyReward"), new StatDisplay("Times Voted", "DailyVote"), null, new StatDisplay("Chests Opened", "Treasure.Old", "Treasure.Ancient", "Treasure.Mythical") },
Material.EMERALD, 0, GameCategory.GLOBAL, "None"),
Material.EMERALD, 0, GameCategory.GLOBAL, "None", false, -1),
HOLIDAY("Holiday Achievements", null,
new StatDisplay[] {},
Material.CAKE, 0, GameCategory.HOLIDAY, "None"),
Material.CAKE, 0, GameCategory.HOLIDAY, "None", false, -1),
BRIDGES("The Bridges", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
Material.IRON_PICKAXE, 0, GameCategory.SURVIVAL, "Destructor Kit"),
Material.IRON_PICKAXE, 0, GameCategory.SURVIVAL, "Destructor Kit", false, GameDisplay.Bridge.getGameId()),
SURVIVAL_GAMES("Survival Games", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED,
@ -36,7 +35,7 @@ public enum AchievementCategory
StatDisplay.fromGame("Wins", GameDisplay.SurvivalGamesTeams, "Wins"), StatDisplay.fromGame("Games Played", GameDisplay.SurvivalGamesTeams, "Wins", "Losses"),
StatDisplay.fromGame("Kills", GameDisplay.SurvivalGamesTeams, "Kills"), StatDisplay.fromGame("Deaths", GameDisplay.SurvivalGamesTeams, "Deaths"),
StatDisplay.fromGame("Gems Earned", GameDisplay.SurvivalGamesTeams, "GemsEarned") },
Material.DIAMOND_SWORD, 0, GameCategory.SURVIVAL, "Horseman Kit"),
Material.DIAMOND_SWORD, 0, GameCategory.SURVIVAL, "Horseman Kit", false, GameDisplay.SurvivalGames.getGameId(), GameDisplay.SurvivalGamesTeams.getGameId()),
SKYWARS("Skywars",null,
new StatDisplay[]{StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED,
@ -44,28 +43,28 @@ public enum AchievementCategory
StatDisplay.fromGame("Wins", GameDisplay.SkywarsTeams, "Wins"), StatDisplay.fromGame("Games Played", GameDisplay.SkywarsTeams, "Wins", "Losses"),
StatDisplay.fromGame("Kills", GameDisplay.SkywarsTeams, "Kills"), StatDisplay.fromGame("Deaths", GameDisplay.SkywarsTeams, "Deaths"),
StatDisplay.fromGame("Gems Earned", GameDisplay.SkywarsTeams, "GemsEarned") },
Material.FEATHER, 0, GameCategory.SURVIVAL, "Destructor Kit"),
Material.FEATHER, 0, GameCategory.SURVIVAL, "Destructor Kit", false, GameDisplay.Skywars.getGameId(), GameDisplay.SkywarsTeams.getGameId()),
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"),
Material.GOLDEN_APPLE, 0, GameCategory.SURVIVAL, "None", false, GameDisplay.UHC.getGameId()),
MC_LEAGUE("MC League", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
Material.IRON_CHESTPLATE, 0, GameCategory.SURVIVAL, "None"),
Material.IRON_CHESTPLATE, 0, GameCategory.SURVIVAL, "None", true, GameDisplay.Minecraft_League.getGameId()),
WIZARDS("Wizards", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
Material.BLAZE_ROD, 0, GameCategory.SURVIVAL, "Witch Doctor Kit"),
Material.BLAZE_ROD, 0, GameCategory.SURVIVAL, "Witch Doctor Kit", false, GameDisplay.Wizards.getGameId()),
CASTLE_SIEGE("Castle Siege", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, new StatDisplay("Kills as Defenders"), new StatDisplay("Deaths as Defenders"),
new StatDisplay("Kills as Undead"), new StatDisplay("Deaths as Undead"), StatDisplay.GEMS_EARNED },
Material.DIAMOND_CHESTPLATE, 0, GameCategory.CLASSICS, null),
Material.DIAMOND_CHESTPLATE, 0, GameCategory.CLASSICS, null, false, GameDisplay.CastleSiege.getGameId()),
BLOCK_HUNT("Block Hunt", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
Material.GRASS, 0, GameCategory.CLASSICS, "Infestor Kit"),
Material.GRASS, 0, GameCategory.CLASSICS, "Infestor Kit", false, GameDisplay.HideSeek.getGameId()),
SMASH_MOBS("Super Smash Mobs", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED,
@ -73,92 +72,92 @@ public enum AchievementCategory
StatDisplay.fromGame("Wins", GameDisplay.SmashTeams, "Wins"), StatDisplay.fromGame("Games Played", GameDisplay.SmashTeams, "Wins", "Losses"),
StatDisplay.fromGame("Kills", GameDisplay.SmashTeams, "Kills"), StatDisplay.fromGame("Deaths", GameDisplay.SmashTeams, "Deaths"),
StatDisplay.fromGame("Gems Earned", GameDisplay.SmashTeams, "GemsEarned")},
Material.SKULL_ITEM, 4, GameCategory.CLASSICS, "Sheep Kit"),
Material.SKULL_ITEM, 4, GameCategory.CLASSICS, "Sheep Kit", false, GameDisplay.Smash.getGameId(), GameDisplay.SmashTeams.getGameId()),
MINE_STRIKE("MineStrike", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
Material.TNT, 0, GameCategory.CLASSICS, "None"),
Material.TNT, 0, GameCategory.CLASSICS, "None", false, GameDisplay.MineStrike.getGameId()),
DRAW_MY_THING("Draw My Thing", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED },
Material.BOOK_AND_QUILL, 0, GameCategory.CLASSICS, "Extra Tools Kit"),
Material.BOOK_AND_QUILL, 0, GameCategory.CLASSICS, "Extra Tools Kit", false, GameDisplay.Draw.getGameId()),
CHAMPIONS("Champions", new String[] {"Champions Domination", "Champions TDM", "Champions CTF"},
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED, new StatDisplay("Flags Captured", "Captures") },
Material.BEACON, 0, GameCategory.CHAMPIONS, "Extra Class Skills"),
Material.BEACON, 0, GameCategory.CHAMPIONS, "Extra Class Skills", false, GameDisplay.ChampionsCTF.getGameId(), GameDisplay.ChampionsDominate.getGameId(), GameDisplay.ChampionsTDM.getGameId()),
MASTER_BUILDERS("Master Builders", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED },
Material.WOOD, 0, GameCategory.CLASSICS, "None"),
Material.WOOD, 0, GameCategory.CLASSICS, "None", false, GameDisplay.Build.getGameId()),
//Arcade
DRAGONS("Dragons", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED },
Material.ENDER_STONE, 0, GameCategory.ARCADE, null),
Material.ENDER_STONE, 0, GameCategory.ARCADE, null, false, GameDisplay.Dragons.getGameId()),
DRAGON_ESCAPE("Dragon Escape", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED },
Material.DRAGON_EGG, 0, GameCategory.ARCADE, "Digger Kit"),
Material.DRAGON_EGG, 0, GameCategory.ARCADE, "Digger Kit", false, GameDisplay.DragonEscape.getGameId()),
SHEEP_QUEST("Sheep Quest", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
Material.WOOL, 0, GameCategory.ARCADE, null),
Material.WOOL, 0, GameCategory.ARCADE, null, false, GameDisplay.Sheep.getGameId()),
SNEAKY_ASSASSINS("Sneaky Assassins", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
Material.INK_SACK, 0, GameCategory.ARCADE, "Briber Kit"),
Material.INK_SACK, 0, GameCategory.ARCADE, "Briber Kit", false, GameDisplay.SneakyAssassins.getGameId()),
ONE_IN_THE_QUIVER("One in the Quiver", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
Material.BOW, 0, GameCategory.ARCADE, "Ninja Kit"),
Material.BOW, 0, GameCategory.ARCADE, "Ninja Kit", false, GameDisplay.Quiver.getGameId()),
SUPER_PAINTBALL("Super Paintball", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
Material.ENDER_PEARL, 0, GameCategory.ARCADE, "Sniper Kit"),
Material.ENDER_PEARL, 0, GameCategory.ARCADE, "Sniper Kit", false, GameDisplay.Paintball.getGameId()),
TURF_WARS("Turf Wars", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
Material.HARD_CLAY, 14, GameCategory.ARCADE, null),
Material.HARD_CLAY, 14, GameCategory.ARCADE, null, false, GameDisplay.TurfWars.getGameId()),
RUNNER("Runner", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
Material.LEATHER_BOOTS, 0, GameCategory.ARCADE, null),
Material.LEATHER_BOOTS, 0, GameCategory.ARCADE, null, false, GameDisplay.Runner.getGameId()),
SPLEEF("Super Spleef", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
Material.IRON_SPADE, 0, GameCategory.ARCADE, null),
Material.IRON_SPADE, 0, GameCategory.ARCADE, null, false, GameDisplay.Spleef.getGameId()),
DEATH_TAG("Death Tag", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
Material.SKULL_ITEM, 0, GameCategory.ARCADE, null),
Material.SKULL_ITEM, 0, GameCategory.ARCADE, null, false, GameDisplay.DeathTag.getGameId()),
SNAKE("Snake", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
Material.WOOL, 4, GameCategory.ARCADE, "Reversal Snake Kit"),
Material.WOOL, 4, GameCategory.ARCADE, "Reversal Snake Kit", false, GameDisplay.Snake.getGameId()),
BACON_BRAWL("Bacon Brawl", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
Material.PORK, 0, GameCategory.ARCADE, null),
Material.PORK, 0, GameCategory.ARCADE, null, false, GameDisplay.BaconBrawl.getGameId()),
MICRO_BATTLE("Micro Battle", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
Material.LAVA_BUCKET, 0, GameCategory.ARCADE, null),
Material.LAVA_BUCKET, 0, GameCategory.ARCADE, null, false, GameDisplay.Micro.getGameId()),
BOMB_LOBBERS("Bomb Lobbers", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
Material.FIREBALL, 0, GameCategory.ARCADE, "Waller Kit"),
Material.FIREBALL, 0, GameCategory.ARCADE, "Waller Kit", false, GameDisplay.Lobbers.getGameId()),
EVOLUTION("Evolution", null,
new StatDisplay[] {StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED},
Material.MONSTER_EGG, 0, GameCategory.ARCADE, "Harvester Kit"),
Material.MONSTER_EGG, 0, GameCategory.ARCADE, "Harvester Kit", false, GameDisplay.Evolution.getGameId()),
MONSTER_MAZE("Monster Maze", null,
new StatDisplay[] {StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED},
Material.ROTTEN_FLESH, 0, GameCategory.ARCADE, "SoonTM"),
Material.ROTTEN_FLESH, 0, GameCategory.ARCADE, "SoonTM", false, GameDisplay.MonsterMaze.getGameId()),
GLADIATORS("Gladiators", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
Material.IRON_SWORD, 0, GameCategory.ARCADE, null),
Material.IRON_SWORD, 0, GameCategory.ARCADE, null, false, GameDisplay.Gladiators.getGameId()),
/*TYPE_WARS("Type Wars", null,
new StatDisplay[] {StatDisplay.WINS, StatDisplay.GAMES_PLAYED, new StatDisplay("Minions killed", "MinionKills"), new StatDisplay("Words Per Minute", false, true, "MinionKills", "TimeInGame"), StatDisplay.GEMS_EARNED},
@ -166,7 +165,7 @@ public enum AchievementCategory
SPEED_BUILDERS("Speed Builders", null,
new StatDisplay[] {StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED, null, new StatDisplay("Perfect Builds", "PerfectBuild")},
Material.QUARTZ_BLOCK, 0, GameCategory.CLASSICS, null);
Material.QUARTZ_BLOCK, 0, GameCategory.CLASSICS, null, false, GameDisplay.SpeedBuilders.getGameId());
private String _name;
@ -176,8 +175,10 @@ public enum AchievementCategory
private GameCategory _gameCategory;
private byte _iconData;
private String _kitReward;
AchievementCategory(String name, String[] statsToPull, StatDisplay[] statDisplays, Material icon, int iconData, GameCategory gameCategory, String kitReward)
public boolean DisplayDivision;
public int[] GameId;
AchievementCategory(String name, String[] statsToPull, StatDisplay[] statDisplays, Material icon, int iconData, GameCategory gameCategory, String kitReward, boolean displayDivision, int... gameId)
{
_name = name;
@ -190,6 +191,9 @@ public enum AchievementCategory
_iconData = (byte)iconData;
_gameCategory = gameCategory;
_kitReward = kitReward;
GameId = gameId;
DisplayDivision = displayDivision;
}
public String getFriendlyName()

View File

@ -21,6 +21,7 @@ import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.donation.DonationManager;
import mineplex.core.elo.EloManager;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.stats.StatsManager;
import mineplex.core.stats.event.StatChangeEvent;
@ -28,6 +29,7 @@ import mineplex.core.stats.event.StatChangeEvent;
public class AchievementManager extends MiniPlugin
{
private StatsManager _statsManager;
private EloManager _eloManager;
private AchievementShop _shop;
private int _interfaceSlot = 7;
@ -37,11 +39,12 @@ public class AchievementManager extends MiniPlugin
private boolean _shopEnabled = true;
public AchievementManager(StatsManager statsManager, CoreClientManager clientManager, DonationManager donationManager)
public AchievementManager(StatsManager statsManager, CoreClientManager clientManager, DonationManager donationManager, EloManager eloManager)
{
super("Achievement Manager", statsManager.getPlugin());
_statsManager = statsManager;
_eloManager = eloManager;
_shop = new AchievementShop(this, _statsManager, clientManager, donationManager, "Achievement");
}
@ -61,6 +64,11 @@ public class AchievementManager extends MiniPlugin
return type.getLevelData(exp);
}
public EloManager getEloManager()
{
return _eloManager;
}
@EventHandler
public void informLevelUp(StatChangeEvent event)

View File

@ -3,14 +3,6 @@ package mineplex.core.achievement.ui.page;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.ChatColor;
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 org.bukkit.inventory.meta.ItemMeta;
import mineplex.core.account.CoreClientManager;
import mineplex.core.achievement.Achievement;
import mineplex.core.achievement.AchievementCategory;
@ -19,17 +11,28 @@ import mineplex.core.achievement.AchievementManager;
import mineplex.core.achievement.ui.AchievementShop;
import mineplex.core.common.util.C;
import mineplex.core.donation.DonationManager;
import mineplex.core.elo.EloManager;
import mineplex.core.elo.EloManager.EloDivision;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.ShopItem;
import mineplex.core.shop.page.ShopPageBase;
import mineplex.core.stats.StatsManager;
import org.bukkit.ChatColor;
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 org.bukkit.inventory.meta.ItemMeta;
public class AchievementPage extends ShopPageBase<AchievementManager, AchievementShop>
{
private static int ACHIEVEMENT_MIDDLE_INDEX = 31;
private AchievementCategory _category;
private StatsManager _statsManager;
private EloManager _eloManager;
private Player _target;
public AchievementPage(AchievementManager plugin, StatsManager statsManager, AchievementCategory category, AchievementShop shop, CoreClientManager clientManager, DonationManager donationManager, Player player, Player target)
@ -39,6 +42,7 @@ public class AchievementPage extends ShopPageBase<AchievementManager, Achievemen
_statsManager = statsManager;
_category = category;
_target = target;
_eloManager = plugin.getEloManager();
buildPage();
}
@ -167,6 +171,31 @@ public class AchievementPage extends ShopPageBase<AchievementManager, Achievemen
setItem(22, item);
}
private void addDivisionDisplay()
{
if (_category.getFriendlyName().startsWith("Global"))
return;
if (!_category.DisplayDivision || _category.GameId.length < 1)
return;
if (_category.GameId.length > 1)
{
for (int i = 0; i < _category.GameId.length; i++)
{
int id = _category.GameId[i];
int elo = _eloManager.getElo(_target, id);
ItemStack disp = EloDivision.getDivision(elo).getVisual(elo);
setItem(44 + i + 1, disp);
}
}
else
{
int id = _category.GameId[0];
int elo = _eloManager.getElo(_target, id);
ItemStack disp = EloDivision.getDivision(elo).getVisual(elo);
setItem(49, disp);
}
}
public List<Achievement> getAchievements()
{

View File

@ -1,72 +0,0 @@
package mineplex.core.elo;
import java.util.UUID;
import org.bukkit.Material;
import org.bukkit.material.MaterialData;
public class EloDivision
{
private byte _divisionPercentile;
private int _playerElo;
private UUID _uuid;
private String _divisionName;
//If I understand MaterialData objects correctly,
private Material _divisionMaterial;
private byte _divisionMaterialValue;
private MaterialData _divisionMaterialData;
public EloDivision(UUID userID, byte divPercent, int pElo)
{
_uuid = userID;
_divisionPercentile = divPercent;
_playerElo = pElo;
_divisionName = calculateDivision(divPercent, _playerElo);
}
public String calculateDivision(double divPercent, int _playerElo)
{
if (divPercent > 99 && _playerElo > 3500) { return "Diamond"; }
if (_playerElo >= 3500) { return "Emerald 3"; }
if (_playerElo < 3500 && _playerElo >= 3300) { return "Emerald 2"; }
if (_playerElo < 3300 && _playerElo >= 3100) { return "Emerald 1"; }
if (_playerElo < 3100 && _playerElo >= 2900) { return "Lapis 3"; }
if (_playerElo < 2900 && _playerElo >= 2700) { return "Lapis 2"; }
if (_playerElo < 2700 && _playerElo >= 2500) { return "Lapis 1"; }
if (_playerElo < 2500 && _playerElo >= 2300) { return "Gold 3"; }
if (_playerElo < 2300 && _playerElo >= 2100) { return "Gold 2"; }
if (_playerElo < 2100 && _playerElo >= 1900) { return "Gold 1"; }
if (_playerElo < 1900 && _playerElo >= 1700) { return "Iron 3"; }
if (_playerElo < 1700 && _playerElo >= 1500) { return "Iron 2"; }
if (_playerElo < 1500 && _playerElo >= 1300) { return "Iron 1"; }
if (_playerElo < 1300 && _playerElo >= 800) { return "Coal 3"; }
if (_playerElo < 800 && _playerElo >= 600) { return "Coal 2"; }
if (_playerElo < 600) { return "Coal 1"; }
//if none of the above are true, a player is in the bottom 20%
return "Coal 1";
}
@SuppressWarnings("deprecation")
//method to set icon's material(since it will change with player's ELO)
public void setDivisionIcon(Material divMat, byte divData)
{
_divisionMaterial = divMat;
_divisionMaterialValue = divData;
_divisionMaterialData = new MaterialData(_divisionMaterial, _divisionMaterialValue);
}
public MaterialData getMaterialData()
{
return _divisionMaterialData;
}
public String getDivisionName()
{
return _divisionName;
}
}

View File

@ -5,9 +5,14 @@ import java.sql.SQLException;
import mineplex.core.MiniDbClientPlugin;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.C;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.itemstack.ItemBuilder;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
public class EloManager extends MiniDbClientPlugin<EloClientData>
@ -101,7 +106,7 @@ public class EloManager extends MiniDbClientPlugin<EloClientData>
});
}
public String getPlayerDivision(Player player, int gameType)
/*public String getPlayerDivision(Player player, int gameType)
{
int playerElo = getElo(player, gameType);
String divisionName = "Player's division";
@ -140,7 +145,7 @@ public class EloManager extends MiniDbClientPlugin<EloClientData>
divisionName = "Coal 1";
return divisionName;
}
}*/
@Override
protected EloClientData AddPlayer(String player)
@ -235,4 +240,86 @@ public class EloManager extends MiniDbClientPlugin<EloClientData>
_eloTeams.clear();
}
public static enum EloDivision
{
DIAMOND("Diamond", -1, 3700, Material.DIAMOND_BLOCK),
EMERALD_3("Emerald 3", 3699, 3500, Material.EMERALD_BLOCK),
EMERALD_2("Emerald 2", 3499, 3300, Material.EMERALD_BLOCK),
EMERALD_1("Emerald 1", 3299, 3100, Material.EMERALD_BLOCK),
LAPIS_3("Lapis 3", 3099, 2900, Material.LAPIS_BLOCK),
LAPIS_2("Lapis 2", 2899, 2700, Material.LAPIS_BLOCK),
LAPIS_1("Lapis 1", 2699, 2500, Material.LAPIS_BLOCK),
GOLD_3("Gold 3", 2499, 2300, Material.GOLD_BLOCK),
GOLD_2("Gold 2", 2299, 2100, Material.GOLD_BLOCK),
GOLD_1("Gold 1", 2099, 1900, Material.GOLD_BLOCK),
IRON_3("Iron 3", 1899, 1700, Material.IRON_BLOCK),
IRON_2("Iron 2", 1699, 1500, Material.IRON_BLOCK),
IRON_1("Iron 1", 1499, 1300, Material.IRON_BLOCK),
COAL_3("Coal 3", 1299, 1100, Material.COAL_BLOCK),
COAL_2("Coal 2", 1099, 900, Material.COAL_BLOCK),
COAL_1("Coal 1", 899, -1, Material.COAL_BLOCK);
private String _disp;
private int _maxElo, _minElo;
private Material _visual;
private EloDivision(String display, int maxElo, int minElo, Material visual)
{
_disp = display;
_maxElo = maxElo;
_minElo = minElo;
_visual = visual;
}
public String getDisplayName()
{
return _disp;
}
public ItemStack getVisual(int elo)
{
ItemBuilder build = new ItemBuilder(_visual);
build.setTitle(C.cGreen + _disp);
int percentage = (elo * 100)/_maxElo;
ChatColor color = ChatColor.YELLOW;
if (percentage <= 35)
color = ChatColor.RED;
else if (percentage >= 65)
color = ChatColor.GREEN;
build.addLore(C.cGold + "Your Progress", color + "" + percentage + " complete with this division.");
return build.build();
}
public static EloDivision getDivision(int elo)
{
for (EloDivision ed : EloDivision.values())
{
boolean applies = true;
if (ed._maxElo != -1)
{
if (elo > ed._maxElo)
{
applies = false;
}
}
if (ed._minElo != -1)
{
if (elo < ed._minElo)
{
applies = false;
}
}
if (applies)
{
return ed;
}
}
return EloDivision.COAL_2;
}
}
}

View File

@ -1,13 +1,7 @@
package mineplex.game.clans;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.CustomTagFix;
import mineplex.core.FoodDupeFix;
import mineplex.core.PacketsInteractionFix;
import mineplex.core.account.CoreClientManager;
import mineplex.core.achievement.AchievementManager;
import mineplex.core.antihack.AntiHack;
@ -19,6 +13,7 @@ import mineplex.core.common.Pair;
import mineplex.core.common.events.ServerShutdownEvent;
import mineplex.core.delayedtask.DelayedTask;
import mineplex.core.donation.DonationManager;
import mineplex.core.elo.EloManager;
import mineplex.core.explosion.Explosion;
import mineplex.core.fallingblock.FallingBlocks;
import mineplex.core.friend.FriendManager;
@ -46,7 +41,6 @@ import mineplex.core.updater.FileUpdater;
import mineplex.core.updater.Updater;
import mineplex.core.visibility.VisibilityManager;
import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.clans.ban.ClansBanManager;
import mineplex.game.clans.items.GearManager;
import mineplex.game.clans.shop.building.BuildingShop;
import mineplex.game.clans.shop.farming.FarmingShop;
@ -56,6 +50,11 @@ import mineplex.game.clans.spawn.travel.TravelShop;
import mineplex.game.clans.world.WorldManager;
import net.minecraft.server.v1_8_R3.MinecraftServer;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
import org.bukkit.plugin.java.JavaPlugin;
public class Clans extends JavaPlugin
{
public static final String VERSION = "Beta 1.0";
@ -124,7 +123,8 @@ public class Clans extends JavaPlugin
IgnoreManager ignoreManager = new IgnoreManager(this, _clientManager, preferenceManager, portal);
StatsManager statsManager = new StatsManager(this, _clientManager);
AchievementManager achievementManager = new AchievementManager(statsManager, _clientManager, _donationManager);
EloManager eloManager = new EloManager(this, _clientManager);
AchievementManager achievementManager = new AchievementManager(statsManager, _clientManager, _donationManager, eloManager);
Chat chat = new Chat(this, incognito, _clientManager, preferenceManager, achievementManager, serverStatusManager.getCurrentServerName());
new MessageManager(this, incognito, _clientManager, preferenceManager, ignoreManager, punish, new FriendManager(this, _clientManager, preferenceManager, portal), chat);

View File

@ -10,6 +10,7 @@ import java.util.TimeZone;
import java.util.UUID;
import mineplex.core.recharge.Recharge;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
@ -57,6 +58,7 @@ import mineplex.core.creature.Creature;
import mineplex.core.creature.event.CreatureSpawnCustomEvent;
import mineplex.core.disguise.DisguiseManager;
import mineplex.core.donation.DonationManager;
import mineplex.core.elo.EloManager;
import mineplex.core.energy.Energy;
import mineplex.core.explosion.Explosion;
import mineplex.core.hologram.Hologram;
@ -334,7 +336,8 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
ServerCommandManager.getInstance().registerCommandType(ClanDeleteCommand.class, new ClanDeleteCommandHandler());
ServerCommandManager.getInstance().registerCommandType(ClanLoadCommand.class, new ClanLoadCommandHandler());
AchievementManager achievementManager = new AchievementManager(statsManager, _clientManager, donationManager);
EloManager eloManager = new EloManager(plugin, _clientManager);
AchievementManager achievementManager = new AchievementManager(statsManager, _clientManager, donationManager, eloManager);
ClassShopManager shopManager = new ClassShopManager(plugin, _classManager, skillManager, itemFactory, achievementManager, _clientManager);
_classShop = new ClassCombatShop(shopManager, _clientManager, donationManager, true, "Class Shop");

View File

@ -133,7 +133,8 @@ public class Hub extends JavaPlugin implements IRelation
FriendManager friendManager = new FriendManager(this, clientManager, preferenceManager, portal);
StatsManager statsManager = new StatsManager(this, clientManager);
AchievementManager achievementManager = new AchievementManager(statsManager, clientManager, donationManager);
EloManager eloManager = new EloManager(this, clientManager);
AchievementManager achievementManager = new AchievementManager(statsManager, clientManager, donationManager, eloManager);
PartyManager partyManager = new PartyManager(this, portal, clientManager, preferenceManager);

View File

@ -2,12 +2,6 @@ package mineplex.staffServer;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
import org.bukkit.plugin.java.JavaPlugin;
import com.mojang.authlib.GameProfile;
import mineplex.core.account.CoreClientManager;
import mineplex.core.achievement.AchievementManager;
import mineplex.core.antihack.AntiHack;
@ -15,7 +9,7 @@ import mineplex.core.chat.Chat;
import mineplex.core.command.CommandCenter;
import mineplex.core.creature.Creature;
import mineplex.core.donation.DonationManager;
import mineplex.core.incognito.IncognitoManager;
import mineplex.core.elo.EloManager;
import mineplex.core.inventory.InventoryManager;
import mineplex.core.memory.MemoryFix;
import mineplex.core.monitor.LagMeter;
@ -33,6 +27,12 @@ import mineplex.staffServer.customerSupport.CustomerSupport;
import mineplex.staffServer.salespackage.SalesPackageManager;
import net.minecraft.server.v1_8_R3.MinecraftServer;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
import org.bukkit.plugin.java.JavaPlugin;
import com.mojang.authlib.GameProfile;
public class StaffServer extends JavaPlugin
{
private String WEB_CONFIG = "webServer";
@ -61,7 +61,8 @@ public class StaffServer extends JavaPlugin
preferenceManager.GiveItem = false;
Portal portal = new Portal(this, clientManager, serverStatusManager.getCurrentServerName());
new Chat(this, null, clientManager, preferenceManager, new AchievementManager(new StatsManager(this, clientManager), clientManager, donationManager), serverStatusManager.getCurrentServerName());
EloManager eloManager = new EloManager(this, clientManager);
new Chat(this, null, clientManager, preferenceManager, new AchievementManager(new StatsManager(this, clientManager), clientManager, donationManager, eloManager), serverStatusManager.getCurrentServerName());
new MemoryFix(this);
new FileUpdater(this, portal, serverStatusManager.getCurrentServerName(), serverStatusManager.getRegion());
AntiHack.Initialize(this, punish, portal, preferenceManager, clientManager);

View File

@ -24,6 +24,7 @@ import mineplex.core.creature.Creature;
import mineplex.core.customdata.CustomDataManager;
import mineplex.core.disguise.DisguiseManager;
import mineplex.core.donation.DonationManager;
import mineplex.core.elo.EloManager;
import mineplex.core.friend.FriendManager;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.give.Give;
@ -135,7 +136,8 @@ public class Arcade extends JavaPlugin
IgnoreManager ignoreManager = new IgnoreManager(this, _clientManager, preferenceManager, portal);
StatsManager statsManager = new StatsManager(this, _clientManager);
AchievementManager achievementManager = new AchievementManager(statsManager, _clientManager, _donationManager);
EloManager eloManager = new EloManager(this, _clientManager);
AchievementManager achievementManager = new AchievementManager(statsManager, _clientManager, _donationManager, eloManager);
FriendManager friendManager = new FriendManager(this, _clientManager, preferenceManager, portal);
Chat chat = new Chat(this, incognito, _clientManager, preferenceManager, achievementManager, serverStatusManager.getCurrentServerName());
new MessageManager(this, incognito, _clientManager, preferenceManager, ignoreManager, punish, friendManager, chat);
@ -160,7 +162,7 @@ public class Arcade extends JavaPlugin
//Arcade Manager
PollManager pollManager = new PollManager(this, _clientManager, _donationManager);
_gameManager = new ArcadeManager(this, serverStatusManager, ReadServerConfig(), _clientManager, _donationManager, _damageManager, statsManager, incognito, achievementManager, disguiseManager, creature, teleport, new Blood(this), chat, portal, preferenceManager, inventoryManager, packetHandler, cosmeticManager, projectileManager, petManager, hologramManager, webServerAddress, pollManager, npcmanager, customDataManager, punish);
_gameManager = new ArcadeManager(this, serverStatusManager, ReadServerConfig(), _clientManager, _donationManager, _damageManager, statsManager, incognito, achievementManager, disguiseManager, creature, teleport, new Blood(this), chat, portal, preferenceManager, inventoryManager, packetHandler, cosmeticManager, projectileManager, petManager, hologramManager, webServerAddress, pollManager, npcmanager, customDataManager, punish, eloManager);
//new BroadcastManager(this, _gameManager);

View File

@ -218,7 +218,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
StatsManager statsManager, IncognitoManager incognitoManager, AchievementManager achievementManager, DisguiseManager disguiseManager, Creature creature, Teleport teleport, Blood blood, Chat chat,
Portal portal, PreferencesManager preferences, InventoryManager inventoryManager, PacketHandler packetHandler,
CosmeticManager cosmeticManager, ProjectileManager projectileManager, PetManager petManager, HologramManager hologramManager, String webAddress, PollManager pollManager,
NpcManager npcManager, CustomDataManager customDataManager, Punish punish)
NpcManager npcManager, CustomDataManager customDataManager, Punish punish, EloManager eloManager)
{
super("Game Manager", plugin);
@ -339,7 +339,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
_classShop = new ClassCombatShop(_classShopManager, clientManager, donationManager, false, "Class Shop");
_eloManager = new EloManager(_plugin, clientManager);
_eloManager = eloManager;
_punishmentManager = punish;

View File

@ -180,7 +180,7 @@ public class MinecraftLeague extends RankedTeamGame
this.InventoryOpenBlock = true;
this.InventoryOpenChest = true;
this.WorldWeatherEnabled = true;
this.WorldWeatherEnabled = false;
this.WorldBlockBurn = true;
this.WorldBlockGrow = true;
this.WorldBoneMeal = true;
@ -1530,7 +1530,7 @@ public class MinecraftLeague extends RankedTeamGame
}
}
/*if (UtilInv.getAmount(player, Material.FISHING_ROD) >= 1)
if (UtilInv.getAmount(player, Material.FISHING_ROD) >= 1)
{
for (ItemStack poss : UtilInv.getItems(player))
{
@ -1540,7 +1540,7 @@ public class MinecraftLeague extends RankedTeamGame
break;
}
}
}*/
}
int arrowsToAdd = UtilInv.getAmount(player, Material.ARROW) / 2;
while (arrowsToAdd >= 1)

View File

@ -24,6 +24,7 @@ import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilWorld;
import mineplex.core.cosmetic.event.ActivateGemBoosterEvent;
import mineplex.core.donation.Donor;
import mineplex.core.elo.EloManager.EloDivision;
import mineplex.core.event.CustomTagEvent;
import mineplex.core.packethandler.PacketHandler;
import mineplex.core.updater.UpdateType;
@ -1144,8 +1145,8 @@ public class GameLobbyManager implements Listener
// Remove old
entry.getValue().resetScores(_divisionMap.get(entry.getKey()) + " ");
// Set new
objective.getScore(Manager.getEloManager().getPlayerDivision(entry.getKey(), Manager.GetGame().GetType().getGameId()) + " ").setScore(line--);
EloDivision ed = EloDivision.getDivision(Manager.getEloManager().getElo(entry.getKey(), Manager.GetGame().GetType().getGameId()));
objective.getScore(ed.getDisplayName() + " ").setScore(line--);
}
}