Merge branch 'master' of ssh://184.154.0.242:7999/min/Mineplex

This commit is contained in:
Jonathan Williams 2015-10-04 00:20:52 -05:00
commit ba17404212
5 changed files with 79 additions and 10 deletions

1
.gitignore vendored
View File

@ -17,6 +17,7 @@ update
Reference Reference
/Plugins/.idea/workspace.xml /Plugins/.idea/workspace.xml
/Plugins/.idea/tasks.xml
/Plugins/out /Plugins/out
BungeeCord BungeeCord
/Plugins/Mineplex.Bungee.Mineplexer/*.gitignore /Plugins/Mineplex.Bungee.Mineplexer/*.gitignore

View File

@ -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.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.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.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.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.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" /> <module fileurl="file://$PROJECT_DIR$/Mineplex.PlayerCache/Mineplex.PlayerCache.iml" filepath="$PROJECT_DIR$/Mineplex.PlayerCache/Mineplex.PlayerCache.iml" />

Binary file not shown.

View File

@ -6,9 +6,11 @@ import mineplex.core.account.CoreClientManager;
import mineplex.core.common.Rank; import mineplex.core.common.Rank;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
import mineplex.core.game.GameDisplay;
import mineplex.core.stats.PlayerStats; import mineplex.core.stats.PlayerStats;
import mineplex.core.stats.StatsManager; import mineplex.core.stats.StatsManager;
import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -24,11 +26,19 @@ public enum AchievementCategory
Material.IRON_PICKAXE, 0, GameCategory.SURVIVAL, "Destructor Kit"), Material.IRON_PICKAXE, 0, GameCategory.SURVIVAL, "Destructor Kit"),
SURVIVAL_GAMES("Survival Games", null, SURVIVAL_GAMES("Survival Games", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED,
null, null, new StatDisplay(C.Bold + "Teams Stats", true), null,
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"),
SKYWARS("Skywars",null, SKYWARS("Skywars",null,
new StatDisplay[]{StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED}, new StatDisplay[]{StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED,
null, null, new StatDisplay(C.Bold + "Team Stats", true), null,
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"),
UHC("Ultra Hardcore", null, UHC("Ultra Hardcore", null,
@ -49,7 +59,11 @@ public enum AchievementCategory
Material.GRASS, 0, GameCategory.CLASSICS, "Infestor Kit"), Material.GRASS, 0, GameCategory.CLASSICS, "Infestor Kit"),
SMASH_MOBS("Super Smash Mobs", null, SMASH_MOBS("Super Smash Mobs", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED,
null, null, new StatDisplay(C.Bold + "Team Stats", true), null,
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"),
MINE_STRIKE("MineStrike", null, MINE_STRIKE("MineStrike", null,
@ -203,6 +217,11 @@ public enum AchievementCategory
lore.add(" "); lore.add(" ");
continue; continue;
} }
else if (_statDisplays[i].isJustDisplayName())
{
lore.add(ChatColor.RESET + _statDisplays[i].getDisplayName());
continue;
}
String displayName = _statDisplays[i].getDisplayName(); String displayName = _statDisplays[i].getDisplayName();
@ -211,9 +230,21 @@ public enum AchievementCategory
continue; continue;
int statNumber = 0; int statNumber = 0;
// This is so we could load stats from other games
// (Refer to team games, displaying team stats in the normal game view)
if (_statDisplays[i].isFullStat())
{
for (String statName : _statDisplays[i].getStats())
statNumber += stats.getStat(statName);
}
else
{
for (String statToPull : _statsToPull) for (String statToPull : _statsToPull)
for (String statName : _statDisplays[i].getStats()) for (String statName : _statDisplays[i].getStats())
statNumber += stats.getStat(statToPull + "." + statName); statNumber += stats.getStat(statToPull + "." + statName);
}
String statString = C.cWhite + statNumber; String statString = C.cWhite + statNumber;
// Need to display special for time // Need to display special for time
@ -224,8 +255,8 @@ public enum AchievementCategory
} }
} }
public static enum GameCategory public enum GameCategory
{ {
GLOBAL, SURVIVAL, CLASSICS, CHAMPIONS, ARCADE; GLOBAL, SURVIVAL, CLASSICS, CHAMPIONS, ARCADE
} }
} }

View File

@ -1,5 +1,7 @@
package mineplex.core.achievement; package mineplex.core.achievement;
import mineplex.core.game.GameDisplay;
/** /**
* The purpose of extracting stats to this class is so we can display stats that are a combination * The purpose of extracting stats to this class is so we can display stats that are a combination
* of different stat values. For example, since we don't have a specific stat for games played of a game, * of different stat values. For example, since we don't have a specific stat for games played of a game,
@ -8,19 +10,34 @@ package mineplex.core.achievement;
*/ */
public class StatDisplay public class StatDisplay
{ {
public String _displayName; private String _displayName;
public String[] _stats; private String[] _stats;
private boolean _fullStat;
private boolean _justDisplayName;
public StatDisplay(String stat) public StatDisplay(String stat)
{
this(stat, false);
}
public StatDisplay(String stat, boolean justDisplayName)
{ {
_displayName = stat; _displayName = stat;
_stats = new String[] { stat }; _stats = new String[] { stat };
_fullStat = false;
_justDisplayName = justDisplayName;
} }
public StatDisplay(String displayName, String... stats) public StatDisplay(String displayName, String... stats)
{
this(displayName, false, stats);
}
public StatDisplay(String displayName, boolean fullStat, String... stats)
{ {
_displayName = displayName; _displayName = displayName;
_stats = stats; _stats = stats;
_fullStat = fullStat;
} }
public String getDisplayName() public String getDisplayName()
@ -28,11 +45,32 @@ public class StatDisplay
return _displayName; return _displayName;
} }
public boolean isJustDisplayName()
{
return _justDisplayName;
}
public String[] getStats() public String[] getStats()
{ {
return _stats; return _stats;
} }
public boolean isFullStat()
{
return _fullStat;
}
public static StatDisplay fromGame(String name, GameDisplay gameDisplay, String... stats)
{
String[] formattedStats = new String[stats.length];
for (int i = 0; i < stats.length; i++)
{
formattedStats[i] = gameDisplay.getName() + "." + stats[i];
}
return new StatDisplay(name, true, formattedStats);
}
public static final StatDisplay WINS = new StatDisplay("Wins"); public static final StatDisplay WINS = new StatDisplay("Wins");
public static final StatDisplay LOSSES = new StatDisplay("Losses"); public static final StatDisplay LOSSES = new StatDisplay("Losses");
public static final StatDisplay KILLS = new StatDisplay("Kills"); public static final StatDisplay KILLS = new StatDisplay("Kills");