set minimum MP level for staff

This commit is contained in:
Chiss 2014-11-08 09:15:27 +11:00
parent 5da0c53997
commit c61ad8907a
4 changed files with 65 additions and 6 deletions

View File

@ -1,5 +1,7 @@
package mineplex.core.achievement;
import mineplex.core.common.util.C;
public enum Achievement
{
GLOBAL_MINEPLEX_LEVEL("Mineplex Level", 20000,
@ -592,11 +594,52 @@ public enum Achievement
{
int[] levels = new int[100];
for (int i=0 ; i<levels.length ; i++)
levels[i] = 2000 + 2000 * i;
int past = 0;
for (int i=0 ; i<20 ; i++)
{
levels[i] = past + 2000;
}
for (int i=20 ; i<40 ; i++)
{
levels[i] = past + 3000;
}
for (int i=40 ; i<60 ; i++)
{
levels[i] = past + 4000;
}
for (int i=60 ; i<80 ; i++)
{
levels[i] = past + 5000;
}
for (int i=80 ; i<levels.length ; i++)
{
levels[i] = past + 6000;
}
return levels;
}
public static String getExperienceString(int level)
{
if (level < 20)
return C.cGray + level;
if (level < 40)
return C.cBlue + level;
if (level < 60)
return C.cDGreen + level;
if (level < 80)
return C.cGold + level;
return C.cRed + level;
}
public String getName()
{

View File

@ -12,6 +12,7 @@ import mineplex.core.MiniPlugin;
import mineplex.core.account.CoreClientManager;
import mineplex.core.achievement.command.StatsCommand;
import mineplex.core.achievement.ui.AchievementShop;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilGear;
@ -190,4 +191,19 @@ public class AchievementManager extends MiniPlugin
return true;
}
public String getMineplexLevel(Player sender, Rank rank)
{
int level = get(sender, Achievement.GLOBAL_MINEPLEX_LEVEL).getLevel();
if (rank.Has(Rank.OWNER))
level = Math.max(level, 50 + get(sender, Achievement.GLOBAL_GEM_HUNTER).getLevel());
else if (rank.Has(Rank.ADMIN))
level = Math.max(level, 30 + get(sender, Achievement.GLOBAL_GEM_HUNTER).getLevel());
else if (rank.Has(Rank.MODERATOR))
level = Math.max(level, 5);
return Achievement.getExperienceString(level) + " " + ChatColor.RESET;
}
}

View File

@ -615,7 +615,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
boolean ownsUltra = _donationManager.Get(player.getName()).OwnsUltraPackage();
//Level Prefix
String levelStr = ChatColor.GRAY + "" + (rank.Has(Rank.ADMIN) ? "" : _achievementManager.get(player, Achievement.GLOBAL_MINEPLEX_LEVEL).getLevel()) + " " + ChatColor.RESET;
String levelStr = _achievementManager.getMineplexLevel(player, rank);
//Rank Prefix
String rankStr = "";

View File

@ -60,9 +60,9 @@ public class GameChatManager implements Listener
if (Manager.GetGame() != null)
ownsUltra= Manager.GetDonation().Get(sender.getName()).OwnsUnknownPackage(Manager.GetServerConfig().ServerType + " ULTRA");
//Level Prefix
String levelStr = ChatColor.GRAY + "" + (rank.Has(Rank.ADMIN) ? "" : Manager.GetAchievement().get(sender, Achievement.GLOBAL_MINEPLEX_LEVEL).getLevel()) + " " + ChatColor.RESET;
//Level
String levelStr = Manager.GetAchievement().getMineplexLevel(sender, rank);
//Rank Prefix
String rankStr = "";
if (rank != Rank.ALL)