Added default ChatStat for all games to prevent my server from dying when testing

This commit is contained in:
Teddy 2016-01-11 19:35:00 +00:00
parent 02ff8bdbdb
commit 88c53bf464
64 changed files with 222 additions and 80 deletions

View File

@ -109,7 +109,7 @@ import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.event.EventModule;
import nautilus.game.arcade.game.games.uhc.UHC;
import nautilus.game.arcade.managers.GameAchievementManager;
import nautilus.game.arcade.managers.GameChatManager;
import nautilus.game.arcade.managers.chat.GameChatManager;
import nautilus.game.arcade.managers.GameCreationManager;
import nautilus.game.arcade.managers.GameFlagManager;
import nautilus.game.arcade.managers.GameGemManager;

View File

@ -273,9 +273,9 @@ public abstract class Game implements Listener
public boolean PlaySoundGameStart = true;
// Chat Stats
public final ChatStatData Kills = new ChatStatData(new String[]{"Kills"}, "Kills", true);
public final ChatStatData Deaths = new ChatStatData(new String[]{"Deaths"}, "Deaths", true);
public final ChatStatData KDRatio = new ChatStatData(new String[]{"KDRatio"}, "KD-Ratio", true);
public final ChatStatData Kills = new ChatStatData("Kills", "Kills", true);
public final ChatStatData Deaths = new ChatStatData("Deaths", "Deaths", true);
public final ChatStatData KDRatio = new ChatStatData("KDRatio", "KD-Ratio", true);
// Gems
public double GemMultiplier = 1;
@ -1426,6 +1426,11 @@ public abstract class Game implements Listener
}
}
public void registerChatStats(ChatStatData... stats)
{
Manager.getGameChatManager().setGameChatStats(stats);
}
public Collection<StatTracker<? extends Game>> getStatTrackers()
{
return _statTrackers;

View File

@ -39,7 +39,7 @@ public class BaconBrawl extends SoloGame
HungerSet = 20;
PrepareFreeze = false;
Manager.getGameChatManager().setGameChatStats(Kills, Deaths);
registerChatStats(Kills);
}
@EventHandler

View File

@ -58,6 +58,8 @@ public class Barbarians extends SoloGame
this.BlockBreakAllow.add(134);
this.BlockBreakAllow.add(135);
this.BlockBreakAllow.add(136);
registerChatStats(Kills);
}
@EventHandler

View File

@ -58,6 +58,8 @@ public class BossBattles extends TeamGame
HungerSet = 20;
CreatureAllowOverride = true;
PrepareFreeze = false;
registerChatStats(Kills);
}
@EventHandler

View File

@ -35,6 +35,8 @@ public class BouncyBalls extends SoloGame
});
this.HungerSet = 20;
registerChatStats();
}
@EventHandler

View File

@ -233,6 +233,8 @@ public class Bridge extends TeamGame implements OreObsfucation
new KillFastStatTracker(this, 4, 10, "Rampage"),
new DeathBomberStatTracker(this, 5)
);
registerChatStats();
}
@EventHandler

View File

@ -215,6 +215,8 @@ public class Build extends SoloGame
_mobShop = new MobShop(getArcadeManager(), getArcadeManager().GetClients(), getArcadeManager().GetDonation());
_optionsShop = new OptionsShop(this, getArcadeManager(), getArcadeManager().GetClients(), getArcadeManager().GetDonation());
_shopItem = ItemStackFactory.Instance.CreateStack(Material.DIAMOND, (byte) 0, 1, C.cGreen + "Options");
registerChatStats();
}
@EventHandler

View File

@ -70,6 +70,8 @@ public class Cards extends SoloGame
this.PrepareFreeze = false;
_cardFactory = new CardFactory();
registerChatStats();
}
@Override

View File

@ -219,6 +219,8 @@ public class CastleSiege extends TeamGame
new TeamDeathsStatTracker(this),
new TeamKillsStatTracker(this)
);
registerChatStats();
}
@Override

View File

@ -87,6 +87,8 @@ public class ChampionsCTF extends CaptureTheFlag
new SpecialWinStatTracker(this, "SpecialWin")
);
registerChatStats();
new ChampionsFixes(this);
}

View File

@ -79,6 +79,8 @@ public class ChampionsDominate extends Domination
new SeismicSlamStatTracker(this)
);
registerChatStats();
new ChampionsFixes(this);
}

View File

@ -79,6 +79,8 @@ public class ChampionsTDM extends TeamDeathmatch
new SeismicSlamStatTracker(this)
);
registerChatStats();
new ChampionsFixes(this);
}

View File

@ -152,6 +152,8 @@ public class Christmas extends SoloGame
HungerSet = 20;
WorldTimeSet = 2000;
PrepareFreeze = false;
registerChatStats();
}
//parse 129 19 47 48 103 86 137 56 22 45 121 14 15 16 87 88 89 153 173 172 162

View File

@ -73,6 +73,8 @@ public class DeathTag extends SoloGame
this.PrepareFreeze = false;
registerStatTrackers(new ComeAtMeBroStatTracker(this));
registerChatStats();
}
@Override

View File

@ -120,6 +120,8 @@ public class DragonEscape extends SoloGame
new ParalympicsStatTracker(this),
new WinMapStatTracker(this)
);
registerChatStats();
}
@Override

View File

@ -70,6 +70,8 @@ public class Dragons extends SoloGame
registerStatTrackers(
new SparklezStatTracker(this)
);
registerChatStats();
}
@Override

View File

@ -135,6 +135,8 @@ public class Draw extends SoloGame
new PureLuckStatTracker(this)
);
registerChatStats();
Manager.GetChat().setThreeSecondDelay(false);
}

View File

@ -163,7 +163,7 @@ public class Evolution extends SoloGame
new KillsWhileEvolvingTracker(this)
);
Manager.getGameChatManager().setGameChatStats(Kills, Deaths);
registerChatStats();
}
public EvolveManager getEvolve()

View File

@ -120,6 +120,8 @@ public class Gladiators extends SoloGame
new SwiftKillTracker(this)
);
registerChatStats();
_playerArenas = new HashMap<>();
_roundState = RoundState.WAITING;

View File

@ -115,6 +115,8 @@ public class Gravity extends SoloGame
this.CompassEnabled = true;
this.WorldBoundaryKill = false;
registerChatStats();
}
@Override

View File

@ -135,6 +135,8 @@ public class Halloween extends SoloGame
this.WorldBoundaryKill = false;
this.DontAllowOverfill = true;
registerChatStats();
}
@Override

View File

@ -341,8 +341,15 @@ public class HideSeek extends TeamGame
Manager.GetExplosion().SetTNTSpread(false);
Manager.getCosmeticManager().setHideParticles(true);
registerStatTrackers(new HunterKillerStatTracker(this), new MeowStatTracker(this), new HunterKillerStatTracker(this),
new HunterOfTheYearStatTracker(this), new BadHiderStatTracker(this));
registerStatTrackers(
new HunterKillerStatTracker(this),
new MeowStatTracker(this),
new HunterKillerStatTracker(this),
new HunterOfTheYearStatTracker(this),
new BadHiderStatTracker(this)
);
registerChatStats();
}
@EventHandler

View File

@ -57,6 +57,8 @@ public class HoleInTheWall extends SoloGame
DamageFall = false;
HungerSet = 20;
WorldTimeSet = 8000;
registerChatStats();
}
private ArrayList<Entry<Integer, Integer>> getWall()

View File

@ -35,6 +35,8 @@ public class Horse extends TeamGame
"",
"Teams swap after game is over"
});
registerChatStats();
}
@Override

View File

@ -74,19 +74,23 @@ public class BombLobbers extends TeamGame implements IThrown
@SuppressWarnings("unchecked")
public BombLobbers(ArcadeManager manager)
{
super(manager, GameType.Lobbers, new Kit[]
super(manager, GameType.Lobbers,
new Kit[]
{
new KitJumper(manager),
new KitArmorer(manager),
new KitPitcher(manager),
new KitWaller(manager)
}, new String[]
},
new String[]
{
"Fight against your enemies using",
"the power of explosives!",
"Left click TNT to throw at your enemy.",
"Last team alive wins!"
});
DamageFall = true;
DamageEvP = true;
@ -110,7 +114,15 @@ public class BombLobbers extends TeamGame implements IThrown
WorldTimeSet = 6000;
registerStatTrackers(new Tracker6Kill(this), new TrackerBlastProof(this), new TrackerNoDamage(this), new TrackerTNTThrown(this), new TrackerDirectHit(this));
registerStatTrackers(
new Tracker6Kill(this),
new TrackerBlastProof(this),
new TrackerNoDamage(this),
new TrackerTNTThrown(this),
new TrackerDirectHit(this)
);
registerChatStats();
}
@EventHandler

View File

@ -58,7 +58,11 @@ public class Micro extends TeamGame
this.BlockBreak = true;
this.BlockPlace = true;
registerStatTrackers(new KillsWithinGameStatTracker(this, 8, "Annihilation"));
registerStatTrackers(
new KillsWithinGameStatTracker(this, 8, "Annihilation")
);
registerChatStats();
}
@Override

View File

@ -97,6 +97,8 @@ public class MilkCow extends SoloGame
_scoreObj = Scoreboard.GetScoreboard().registerNewObjective("Milk", "dummy");
_scoreObj.setDisplaySlot(DisplaySlot.BELOW_NAME);
registerChatStats();
}
@Override

View File

@ -310,14 +310,14 @@ public class MineStrike extends TeamGame
new TeamKillsStatTracker(this)
);
Manager.getGameChatManager().setGameChatStats(
registerChatStats(
Kills,
new ChatStatData(new String[]{"BoomHeadshot"}, "Headshots", true),
new ChatStatData("BoomHeadshot", "Headshots", true),
new ChatStatData().blankLine(),
Deaths,
KDRatio,
new ChatStatData().blankLine(),
new ChatStatData(new String[]{null}, C.cGray + C.Italics + "Testing stage", false)
new ChatStatData().plainText(C.cGray + C.Italics + "Testing stage")
);
}

View File

@ -84,6 +84,8 @@ public class MineWare extends SoloGame
Manager.GetCreature().SetDisableCustomDrops(true);
PopulateOrders();
registerChatStats();
}
@Override

View File

@ -31,6 +31,8 @@ public class Moba extends TeamGame
this.DeathSpectateSecs = 8;
this.HungerSet = 20;
registerChatStats();
}
@Override

View File

@ -63,6 +63,8 @@ public class MonsterLeague extends TeamGame
this.TeamArmor = true;
this.TeamArmorHotbar = true;
registerChatStats();
}
//Supports anywhere from 2-4 teams on a map

View File

@ -101,6 +101,8 @@ public class MonsterMaze extends SoloGame
new SurvivePast10thSafepadTracker(this)
);
//_maze = new SnowmanMaze(this, WorldData.GetDataLocs("GRAY")/*, WorldData.GetCustomLocs("103")*/);
registerChatStats();
}
public Maze getMaze()

View File

@ -88,6 +88,8 @@ public class OldMineWare extends SoloGame
InventoryClick = true;
PopulateOrders();
registerChatStats();
}
@Override

View File

@ -114,6 +114,8 @@ public class Paintball extends TeamGame
new WinFastStatTracker(this, 30, "Speedrunner"),
new LastStandStatTracker(this)
);
registerChatStats();
}
@EventHandler

View File

@ -92,6 +92,8 @@ public class Quiver extends SoloGame
new SharpShooterStatTracker(this),
new WinWithoutBowStatTracker(this, "WhatsABow")
);
registerChatStats();
}
@EventHandler(priority = EventPriority.HIGH)

View File

@ -65,6 +65,8 @@ public class QuiverTeams extends TeamGame
this.TeamArmor = true;
this.TeamArmorHotbar = true;
registerChatStats();
}
@EventHandler(priority = EventPriority.HIGH)

View File

@ -66,6 +66,8 @@ public class Runner extends SoloGame implements IThrown
this.PrepareFreeze = false;
registerStatTrackers(new DistanceTraveledStatTracker(this, "MarathonRunner"));
registerChatStats();
}
@EventHandler

View File

@ -72,6 +72,8 @@ public class SearchAndDestroy extends TeamGame
DamageSelf = false;
Manager.GetDamage().GetCombatManager().setUseWeaponName(AttackReason.DefaultWeaponName);
registerChatStats();
}
public ArrayList<TeamBomb> getBombs()

View File

@ -155,6 +155,8 @@ public class SheepGame extends TeamGame
new SheepDropStatTracker(this),
new WinWithSheepStatTracker(this)
);
registerChatStats();
}
@Override

View File

@ -36,6 +36,8 @@ public class SoloSkywars extends Skywars
this.DamageTeamSelf = true;
registerChatStats();
}
@EventHandler

View File

@ -53,6 +53,8 @@ public class TeamSkywars extends Skywars
this.DamageTeamSelf = false;
this.DontAllowOverfill = true;
registerChatStats();
}
@EventHandler

View File

@ -32,6 +32,8 @@ public class SoloSuperSmash extends SuperSmash
});
this.DamageTeamSelf = true;
registerChatStats();
}
@EventHandler

View File

@ -55,6 +55,8 @@ public class SuperSmashDominate extends Domination
new KitMagmaCube(manager),
});
registerChatStats();
}
@EventHandler(priority = EventPriority.LOWEST)

View File

@ -53,6 +53,8 @@ public class TeamSuperSmash extends SuperSmash
this.TeamArmorHotbar = true;
this.DontAllowOverfill = true;
registerChatStats();
}
@Override

View File

@ -157,6 +157,8 @@ public class Snake extends SoloGame
new ChooChooStatTracker(this),
new SlimySheepStatTracker(this)
);
registerChatStats();
}
@EventHandler

View File

@ -92,6 +92,8 @@ public class SneakyAssassins extends SoloGame
new RevealStatTracker(this, "ISeeYou"),
_killEntityStatTracker
);
registerChatStats();
}
@Override

View File

@ -105,6 +105,8 @@ public class SnowFight extends TeamGame
this.TeamArmor = true;
this.TeamArmorHotbar = true;
registerChatStats();
// this.WorldWeatherEnabled = true;
// this.WorldTimeSet = 4000;
}

View File

@ -62,6 +62,8 @@ public class Spleef extends SoloGame
this.PrepareFreeze = false;
registerStatTrackers(new SpleefBlockDestroyStatTracker(this));
registerChatStats();
}
@EventHandler

View File

@ -59,6 +59,8 @@ public class SpleefTeams extends TeamGame
this.TeamArmor = true;
this.TeamArmorHotbar = true;
registerChatStats();
}
@EventHandler

View File

@ -50,6 +50,8 @@ public class SquidShooter extends SoloGame
this.PrepareFreeze = false;
this.CompassEnabled = true;
this.KitRegisterState = GameState.Prepare;
registerChatStats();
}
@EventHandler
public void Death(CombatDeathEvent event)

View File

@ -54,6 +54,8 @@ public class Stacker extends SoloGame implements IThrown
"Players lose 5 stacked animals if they get hit.",
"First to stack 16 high wins!"
});
registerChatStats();
}
@EventHandler

View File

@ -40,6 +40,8 @@ public class SoloSurvivalGames extends SurvivalGames
this.DamageTeamSelf = true;
registerChatStats();
}
@EventHandler

View File

@ -255,6 +255,8 @@ public class SurvivalGamesTeams extends TeamGame
//Tournament
if (Manager.IsTournamentServer())
QuitOut = false;
registerChatStats();
}
@Override

View File

@ -60,6 +60,8 @@ public class TeamSurvivalGames extends SurvivalGames
this.DontAllowOverfill = true;
registerChatStats();
}
@EventHandler

View File

@ -75,6 +75,8 @@ public class Tug extends TeamGame
this.DeathOut = false;
this.DeathSpectateSecs = 20;
registerChatStats();
}
@Override

View File

@ -153,6 +153,8 @@ public class TurfForts extends TeamGame
new BehindEnemyLinesStatTracker(this),
new TheComebackStatTracker(this)
);
registerChatStats();
}
@Override

View File

@ -168,6 +168,8 @@ public class TypeWars extends TeamGame
new TimeInGameTracker(this)
);
registerChatStats();
manager.GetCreature().SetDisableCustomDrops(true);
manager.GetChat().setThreeSecondDelay(false);
}

View File

@ -207,6 +207,8 @@ public class UHC extends TeamGame
_createTime = System.currentTimeMillis();
_serverTime = Utility.currentTimeMillis();
registerChatStats();
}
@Override

View File

@ -148,6 +148,8 @@ public class WitherGame extends TeamGame implements IBlockRestorer
new TeamDeathsStatTracker(this),
new TeamKillsStatTracker(this)
);
registerChatStats();
}
@Override

View File

@ -166,6 +166,8 @@ public class Wizards extends SoloGame
SoupEnabled = false;
DamageTeamSelf = true;
registerChatStats();
Manager.getCosmeticManager().setHideParticles(true);
// Manager.GetDamage().GetCombatManager().setUseWeaponName(AttackReason.DefaultWeaponName);

View File

@ -71,6 +71,8 @@ public class ZombieSurvival extends SoloGame
this.HungerSet = 20;
this.CompassEnabled = true;
registerChatStats();
}
@Override

View File

@ -1,13 +1,11 @@
package nautilus.game.arcade.managers.chat;
import mineplex.core.chat.Chat;
/**
* Created by TeddyDev on 10/01/2016.
*/
public class ChatStatData
{
private String[] _stat;
private String _stat;
private String _display;
private boolean _isValue;
@ -16,7 +14,7 @@ public class ChatStatData
}
public ChatStatData(String[] stat, String display, boolean isValue)
public ChatStatData(String stat, String display, boolean isValue)
{
_stat = stat;
_display = display;
@ -25,14 +23,23 @@ public class ChatStatData
public ChatStatData blankLine()
{
_stat = new String[]{null};
_stat = null;
_display = " ";
_isValue = false;
return this;
}
public String[] getStat()
public ChatStatData plainText(String text)
{
_stat = null;
_display = text;
_isValue = false;
return this;
}
public String getStat()
{
return _stat;
}

View File

@ -1,4 +1,4 @@
package nautilus.game.arcade.managers;
package nautilus.game.arcade.managers.chat;
import java.text.DecimalFormat;
import java.util.AbstractMap;
@ -269,7 +269,6 @@ public class GameChatManager implements Listener
_chatStats = new LinkedList<ChatStatData>();
for(ChatStatData chatStat : stats)
{
System.out.println(chatStat.getStat());
_chatStats.add(chatStat);
}
}
@ -294,7 +293,7 @@ public class GameChatManager implements Listener
}
ChatStatData chatStatData = hoverText.get(i);
String display = (chatStatData.getDisplay() == null ? chatStatData.getStat()[0] : chatStatData.getDisplay());
String display = (chatStatData.getDisplay() == null ? chatStatData.getStat() : chatStatData.getDisplay());
if(!chatStatData.isValue())
{
@ -302,7 +301,7 @@ public class GameChatManager implements Listener
continue;
}
if (chatStatData.getStat()[0].equalsIgnoreCase("kdratio"))
if (chatStatData.getStat().equalsIgnoreCase("kdratio"))
{
int kills;
int deaths;
@ -321,9 +320,9 @@ public class GameChatManager implements Listener
continue;
}
if (game.GetStats().get(player).containsKey(gameName + "." + chatStatData.getStat()[0]))
if (game.GetStats().get(player).containsKey(gameName + "." + chatStatData.getStat()))
{
temp.add(new AbstractMap.SimpleEntry<String, String>(display + ": ", (game.GetStats().get(player).get(gameName + "." + chatStatData.getStat()[0]).toString())));
temp.add(new AbstractMap.SimpleEntry<String, String>(display + ": ", (game.GetStats().get(player).get(gameName + "." + chatStatData.getStat()).toString())));
}
else
{