Achievement fix + active

This commit is contained in:
Chiss 2014-08-12 11:23:53 +10:00
parent 02270a9d25
commit 2d67d4ce36
4 changed files with 45 additions and 31 deletions

View File

@ -2,17 +2,27 @@ package mineplex.core.achievement;
public enum Achievement public enum Achievement
{ {
GLOBAL_GEM_HUNTER("Gem Hunter", new String[] {"Global.GemsEarned"}, new int[] {10000, 15000, 20000, 25000, 30000, 35000, 40000, 45000, 50000, 55000, 60000, 65000}), GLOBAL_GEM_HUNTER("Gem Hunter",
new String[] {"Global.GemsEarned"},
new String[] {"+1 for every Gem earned in any game."},
new int[] {10000, 15000, 20000, 25000, 30000, 35000, 40000, 45000, 50000, 55000, 60000, 65000});
GAME_SPLEEF_SMASHER("Spleef Smasher", new String[] {"Super Spleef.BlocksBroken"}, new int[] {100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200}); /*
GAME_SPLEEF_SMASHER("Spleef Smasher",
new String[] {"Super Spleef.BlocksBroken"},
new String[] {"+1 for every broken Block in Spleef."},
new int[] {100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200});
*/
private String _name; private String _name;
private String[] _desc;
private String[] _stats; private String[] _stats;
private int[] _levels; private int[] _levels;
Achievement(String name, String[] stats, int[] levels) Achievement(String name, String[] stats, String[] desc, int[] levels)
{ {
_name = name; _name = name;
_desc = desc;
_stats = stats; _stats = stats;
_levels = levels; _levels = levels;
} }
@ -22,6 +32,11 @@ public enum Achievement
return _name; return _name;
} }
public String[] getDesc()
{
return _desc;
}
public String[] getStats() public String[] getStats()
{ {
return _stats; return _stats;

View File

@ -50,9 +50,7 @@ public class StatsManager extends MiniClientPlugin<PlayerStats>
public void incrementStat(Player player, final String statName, int value) public void incrementStat(Player player, final String statName, int value)
{ {
int newValue = Get(player).addStat(statName, Get(player).getStat(statName) + value); int newValue = Get(player).addStat(statName, value);
System.out.println(player.getName() + " - " + statName + " - " + value + " ? " + newValue);
//Event //Event
UtilServer.getServer().getPluginManager().callEvent(new StatChangeEvent(player.getName(), statName, newValue - value, newValue)); UtilServer.getServer().getPluginManager().callEvent(new StatChangeEvent(player.getName(), statName, newValue - value, newValue));

View File

@ -42,7 +42,7 @@ public class GameAchievementManager implements Listener
Manager.GetAchievement().clearLog(event.getPlayer()); Manager.GetAchievement().clearLog(event.getPlayer());
} }
//@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR)
public void processAchievementLog(final GameStateChangeEvent event) public void processAchievementLog(final GameStateChangeEvent event)
{ {
if (Manager.IsTournamentServer()) if (Manager.IsTournamentServer())
@ -85,19 +85,29 @@ public class GameAchievementManager implements Listener
AchivementData data = Manager.GetAchievement().get(player, type); AchivementData data = Manager.GetAchievement().get(player, type);
String nameLevel = F.elem(C.cGold + C.Bold + type.getName() + " " + ChatColor.RESET + C.cYellow + data.getLevel() + C.cGold + "/" + C.cYellow + type.getMaxLevel());
String progress = F.elem(C.cGreen + "+" + log.get(type).Amount);
if (log.get(type).LevelUp) if (log.get(type).LevelUp)
{ {
UtilPlayer.message(player, F.elem(type.getName() + " " + data.getLevel() + "/" + type.getMaxLevel()) + UtilPlayer.message(player, nameLevel + " " + progress +
" " + F.elem(C.cGreen + "+" + log.get(type).Amount) + " " + F.elem(C.cAqua + C.Bold + "LEVEL UP!"));
" " + F.elem(C.cAqua + "LEVELED UP!"));
player.playSound(player.getLocation(), Sound.LEVEL_UP, 1f, 1f);
} }
else else
{ {
UtilPlayer.message(player, F.elem(type.getName() + " " + data.getLevel() + "/" + type.getMaxLevel()) + UtilPlayer.message(player, nameLevel + " " + progress +
" " + F.elem(C.cGreen + "+" + log.get(type).Amount) +
" " + F.elem(ChatColor.YELLOW + "" + (data.getExpNextLevel() - data.getExpRemainder()) + " to Next Level")); " " + F.elem(ChatColor.YELLOW + "" + (data.getExpNextLevel() - data.getExpRemainder()) + " to Next Level"));
} }
for (String desc : type.getDesc())
{
UtilPlayer.message(player, desc);
out++;
}
out++; out++;
} }

View File

@ -32,7 +32,6 @@ public class GameGemManager implements Listener
ArcadeManager Manager; ArcadeManager Manager;
boolean DoubleGem = false; boolean DoubleGem = false;
boolean GemFinder = false;
public GameGemManager(ArcadeManager manager) public GameGemManager(ArcadeManager manager)
{ {
@ -166,16 +165,12 @@ public class GameGemManager implements Listener
total += (int)(earned * game.GetGemBoostAmount()); total += (int)(earned * game.GetGemBoostAmount());
//Gem Finder //Gem Finder
if (GemFinder) int gemFinder = Manager.GetAchievement().get(player.getName(), Achievement.GLOBAL_GEM_HUNTER).getLevel();
if (gemFinder > 0)
{ {
int gemFinder = Manager.GetAchievement().get(player.getName(), Achievement.GLOBAL_GEM_HUNTER).getLevel(); total += (int)(earned * (gemFinder * 0.25));
if (gemFinder > 0)
{
total += (int)(earned * (gemFinder * 0.25));
}
} }
if (DoubleGem) if (DoubleGem)
total += earned; total += earned;
@ -233,18 +228,14 @@ public class GameGemManager implements Listener
totalGems += earnedGems * game.GetGemBoostAmount(); totalGems += earnedGems * game.GetGemBoostAmount();
} }
//Gem Finder //Gem Finder
if (GemFinder) int gemFinder = Manager.GetAchievement().get(player.getName(), Achievement.GLOBAL_GEM_HUNTER).getLevel();
if (gemFinder > 0)
{ {
int gemFinder = Manager.GetAchievement().get(player.getName(), Achievement.GLOBAL_GEM_HUNTER).getLevel(); UtilPlayer.message(player, F.elem(C.cGreen + "+" + ((int)(earnedGems*(gemFinder * 0.25)) + " Gems") + " for " +
if (gemFinder > 0) F.elem("Gem Hunter " + gemFinder + C.cGreen + " +" + (gemFinder*25) + "%")));
{
UtilPlayer.message(player, F.elem(C.cGreen + "+" + ((int)(earnedGems*(gemFinder * 0.25)) + " Gems") + " for " +
F.elem("Gem Hunter " + gemFinder + C.cGreen + " +" + (gemFinder*25) + "%")));
totalGems += earnedGems * (gemFinder * 0.25); totalGems += earnedGems * (gemFinder * 0.25);
}
} }
//Double Gem //Double Gem