Merge remote-tracking branch 'origin/master'

This commit is contained in:
Shaun Bennett 2014-08-26 17:41:07 -05:00
commit c04319345a
65 changed files with 194 additions and 112 deletions

View File

@ -143,20 +143,23 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
}
});
}
if (Plugin.getPetManager().hasActivePet(Player.getName()))
if (Plugin.getGadgetManager().getActive(Player, GadgetType.Morph) != null)
{
AddButton(40, new ShopItem(Material.MONSTER_EGG, (byte)Plugin.getPetManager().getActivePet(Player.getName()).getType().getTypeId(), C.mItem + Plugin.getPetManager().getActivePet(Player.getName()).getCustomName(), new String[] {}, 1, false, false),
new SingleButton()
final Gadget gadget = Plugin.getGadgetManager().getActive(Player, GadgetType.Morph);
AddButton(40,
new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), C.mItem + gadget.GetName(), new String[] {}, 1, false, false),
new SingleButton()
{
@Override
public void Clicked(Player player)
{
@Override
public void Clicked(Player player)
{
PlayAcceptSound(player);
Plugin.getPetManager().RemovePet(player, true);
Refresh();
}
});
PlayAcceptSound(player);
gadget.Disable(player);
Refresh();
}
});
}
if (Plugin.getMountManager().getActive(Player) != null)
@ -177,22 +180,19 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
});
}
if (Plugin.getGadgetManager().getActive(Player, GadgetType.Morph) != null)
if (Plugin.getPetManager().hasActivePet(Player.getName()))
{
final Gadget gadget = Plugin.getGadgetManager().getActive(Player, GadgetType.Morph);
AddButton(44,
new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), C.mItem + gadget.GetName(), new String[] {}, 1, false, false),
new SingleButton()
{
@Override
public void Clicked(Player player)
AddButton(44, new ShopItem(Material.MONSTER_EGG, (byte)Plugin.getPetManager().getActivePet(Player.getName()).getType().getTypeId(), C.mItem + Plugin.getPetManager().getActivePet(Player.getName()).getCustomName(), new String[] {}, 1, false, false),
new SingleButton()
{
PlayAcceptSound(player);
gadget.Disable(player);
Refresh();
}
});
@Override
public void Clicked(Player player)
{
PlayAcceptSound(player);
Plugin.getPetManager().RemovePet(player, true);
Refresh();
}
});
}
}

View File

@ -6,6 +6,7 @@ import mineplex.core.command.CommandCenter;
import mineplex.core.creature.Creature;
import mineplex.core.donation.DonationManager;
import mineplex.core.inventory.InventoryManager;
import mineplex.core.join.JoinQuit;
import mineplex.core.memory.MemoryFix;
import mineplex.core.monitor.LagMeter;
import mineplex.core.npc.NpcManager;
@ -15,10 +16,13 @@ import mineplex.core.preferences.PreferencesManager;
import mineplex.core.recharge.Recharge;
import mineplex.core.status.ServerStatusManager;
import mineplex.core.updater.FileUpdater;
import mineplex.core.updater.Updater;
import mineplex.staffServer.customerSupport.CustomerSupport;
import mineplex.staffServer.password.Password;
import mineplex.staffServer.salespackage.SalesPackageManager;
import net.minecraft.server.v1_7_R4.MinecraftServer;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
public class StaffServer extends JavaPlugin
@ -52,8 +56,15 @@ public class StaffServer extends JavaPlugin
new Chat(this, clientManager, preferenceManager, serverStatusManager.getCurrentServerName());
new MemoryFix(this);
new FileUpdater(this, portal);
new CustomerSupport(this, clientManager, donationManager, new SalesPackageManager(this, clientManager, donationManager, new InventoryManager(this)));
new Password(this);
//Updates
getServer().getScheduler().scheduleSyncRepeatingTask(this, new Updater(this), 1, 1);
MinecraftServer.getServer().getPropertyManager().setProperty("debug", true);
Bukkit.getWorlds().get(0).setSpawnLocation(0, 102, 0);
}
}

View File

@ -9,15 +9,21 @@ import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.FoodLevelChangeEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.MiniPlugin;
import mineplex.core.account.CoreClient;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.donation.DonationManager;
import mineplex.core.donation.Donor;
import mineplex.core.donation.repository.token.CoinTransactionToken;
@ -42,6 +48,27 @@ public class CustomerSupport extends MiniPlugin
_salesPackageManager = salesPackageManager;
}
@EventHandler
public void Join(PlayerJoinEvent event)
{
event.setJoinMessage(F.sys("Join", event.getPlayer().getName()));
}
@EventHandler
public void Quit(PlayerQuitEvent event)
{
event.setQuitMessage(F.sys("Quit", event.getPlayer().getName()));
}
@EventHandler
public void PlayerChat(AsyncPlayerChatEvent event)
{
if (event.isCancelled())
return;
event.setFormat(C.cGold + "%1$s " + C.cWhite + "%2$s");
}
@Override
public void AddCommands()
{

View File

@ -72,10 +72,6 @@ public class Arcade extends JavaPlugin
String webServerAddress = getConfig().getString(WEB_CONFIG);
int andthecatisdog = 0;
andthecatisdog += andthecatisdog;
andthecatisdog = 5;
Logger.initialize(this);
//Static Modules

View File

@ -111,7 +111,7 @@ public class HideSeek extends TeamGame
}
}
public static class ChangeFormEvent extends PlayerEvent
public static class PlayerChangeFormEvent extends PlayerEvent
{
private static final HandlerList handlers = new HandlerList();
@ -128,7 +128,7 @@ public class HideSeek extends TeamGame
private final Form _form;
public ChangeFormEvent(Player who, Form form)
public PlayerChangeFormEvent(Player who, Form form)
{
super(who);
@ -141,6 +141,27 @@ public class HideSeek extends TeamGame
}
}
public static class PlayerSolidifyEvent extends PlayerEvent
{
private static final HandlerList handlers = new HandlerList();
public static HandlerList getHandlerList()
{
return handlers;
}
@Override
public HandlerList getHandlers()
{
return getHandlerList();
}
public PlayerSolidifyEvent(Player who)
{
super(who);
}
}
private GameTeam _hiders;
private GameTeam _seekers;
@ -355,7 +376,7 @@ public class HideSeek extends TeamGame
_forms.put(event.GetPlayer(), form);
Bukkit.getPluginManager().callEvent(new ChangeFormEvent(event.GetPlayer(), form));
Bukkit.getPluginManager().callEvent(new PlayerChangeFormEvent(event.GetPlayer(), form));
}
}
@ -392,7 +413,7 @@ public class HideSeek extends TeamGame
//Set New
_forms.put(player, form);
Bukkit.getPluginManager().callEvent(new ChangeFormEvent(player, form));
Bukkit.getPluginManager().callEvent(new PlayerChangeFormEvent(player, form));
}
@EventHandler
@ -426,7 +447,7 @@ public class HideSeek extends TeamGame
//Set New
_forms.put(player, form);
Bukkit.getPluginManager().callEvent(new ChangeFormEvent(player, form));
Bukkit.getPluginManager().callEvent(new PlayerChangeFormEvent(player, form));
}
@EventHandler
@ -458,7 +479,7 @@ public class HideSeek extends TeamGame
//Set New
_forms.put(player, form);
Bukkit.getPluginManager().callEvent(new ChangeFormEvent(player, form));
Bukkit.getPluginManager().callEvent(new PlayerChangeFormEvent(player, form));
}
@EventHandler

View File

@ -14,6 +14,7 @@ import mineplex.core.recharge.Recharge;
import nautilus.game.arcade.game.games.hideseek.HideSeek;
import nautilus.game.arcade.game.games.hideseek.kits.KitHiderQuick;
import org.bukkit.Bukkit;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material;
@ -139,6 +140,8 @@ public class BlockForm extends Form
return;
}
Bukkit.getPluginManager().callEvent(new HideSeek.PlayerSolidifyEvent(Player));
//Set Block
_block = block;

View File

@ -92,6 +92,8 @@ public class GameAchievementManager implements Listener
String progress = F.elem(C.cGreen + "+" + log.get(type).Amount);
boolean displayDesc = true;
//Completed Achievement
if (data.getLevel() == type.getMaxLevel())
{
@ -114,6 +116,7 @@ public class GameAchievementManager implements Listener
else
{
//Display nothing because already complete bro :O
displayDesc = false;
}
}
//Multi-Level Achievements
@ -149,11 +152,12 @@ public class GameAchievementManager implements Listener
}
}
for (String desc : type.getDesc())
{
UtilPlayer.message(player, desc);
out++;
}
if (displayDesc)
for (String desc : type.getDesc())
{
UtilPlayer.message(player, desc);
out++;
}
out++;

View File

@ -31,10 +31,10 @@ public class AssistsStatTracker extends StatTracker<Game>
if (player != null)
{
getGame().AddStat(player, "Assists", 1, false, false);
addStat(player, "Assists", 1, false, false);
if (getGame().GetKit(player) != null)
getGame().AddStat(player, getGame().GetKit(player).GetName() + " Assists", 1, false, false);
addStat(player, getGame().GetKit(player).GetName() + " Assists", 1, false, false);
}
}
}

View File

@ -55,7 +55,7 @@ public class BackstabKillStatTracker extends StatTracker<Game>
Set<UUID> hasDamaged = _hasDamaged.get(player.getUniqueId());
if (hasDamaged == null || !hasDamaged.contains(killer.getUniqueId()))
getGame().AddStat(killer, "Assassination", 1, false, false);
addStat(killer, "Assassination", 1, false, false);
}
}

View File

@ -12,7 +12,6 @@ import org.bukkit.event.entity.PlayerDeathEvent;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.games.hideseek.HideSeek;
import nautilus.game.arcade.game.games.hideseek.forms.CreatureForm;
public class BadHiderStatTracker extends StatTracker<HideSeek>
{
@ -24,13 +23,12 @@ public class BadHiderStatTracker extends StatTracker<HideSeek>
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onChangeForm(HideSeek.ChangeFormEvent event)
public void onChangeForm(HideSeek.PlayerChangeFormEvent event)
{
if (getGame().GetState() != Game.GameState.Live)
return;
if (event.getForm() instanceof CreatureForm)
_disqualified.add(event.getPlayer().getUniqueId());
_disqualified.add(event.getPlayer().getUniqueId());
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
@ -42,6 +40,15 @@ public class BadHiderStatTracker extends StatTracker<HideSeek>
_disqualified.add(event.getEntity().getUniqueId());
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onPlayerSolidify(HideSeek.PlayerSolidifyEvent event)
{
if (getGame().GetState() != Game.GameState.Live)
return;
_disqualified.add(event.getPlayer().getUniqueId());
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onGameStateChange(GameStateChangeEvent event)
{
@ -50,7 +57,7 @@ public class BadHiderStatTracker extends StatTracker<HideSeek>
for (Player player : getGame().getHiders().GetPlayers(true))
{
if (!_disqualified.contains(player.getUniqueId()))
getGame().AddStat(player, "BadHider", 1, true, false);
addStat(player, "BadHider", 1, true, false);
}
}
}

View File

@ -28,7 +28,7 @@ public class BehindEnemyLinesStatTracker extends StatTracker<TurfForts>
Long time = getGame().getEnemyTurfEntranceTime(player);
if (time != null && System.currentTimeMillis() - time >= 15000)
getGame().AddStat(player, "BehindEnemyLines", 1, true, false);
addStat(player, "BehindEnemyLines", 1, true, false);
}
}
}

View File

@ -26,7 +26,7 @@ public class BlockShreadStatTracker extends StatTracker<Game>
Player shooter = (Player) event.getArrow().getShooter();
if (getGame().GetKit(shooter) instanceof KitShredder)
getGame().AddStat(shooter, "TheShreddinator", 1, false, false);
addStat(shooter, "TheShreddinator", 1, false, false);
}
}
}

View File

@ -58,7 +58,7 @@ public class BloodThirstyStatTracker extends StatTracker<Game>
_kills.put(killer.getUniqueId(), kills);
if (kills >= 50)
getGame().AddStat(killer, "BloodThirsty", 1, true, false);
addStat(killer, "BloodThirsty", 1, true, false);
}
}
}

View File

@ -49,7 +49,7 @@ public class BridgesSniperStatTracker extends StatTracker<Bridge>
EntityDamageByEntityEvent edbee = (EntityDamageByEntityEvent) player.getLastDamageCause();
if (edbee.getDamager() instanceof Arrow)
getGame().AddStat(killer, "Sniper", 1, true, false);
addStat(killer, "Sniper", 1, true, false);
}
}
}

View File

@ -32,6 +32,6 @@ public class CannibalStatTracker extends StatTracker<Game>
_kills.put(event.getKiller().getUniqueId(), killCount);
if (killCount >= 8)
getGame().AddStat(event.getKiller(), "Cannibal", 1, true, false);
addStat(event.getKiller(), "Cannibal", 1, true, false);
}
}

View File

@ -20,6 +20,6 @@ public class ChooChooStatTracker extends StatTracker<Game>
return;
if (event.getLength() >= 60)
getGame().AddStat(event.getPlayer(), "ChooChoo", 1, true, false);
addStat(event.getPlayer(), "ChooChoo", 1, true, false);
}
}

View File

@ -57,7 +57,7 @@ public class ComeAtMeBroStatTracker extends StatTracker<Game>
_count.put(killer.getUniqueId(), count);
if (count >= 2)
getGame().AddStat(killer, "ComeAtMeBro", 1, true, false);
addStat(killer, "ComeAtMeBro", 1, true, false);
}
}
}

View File

@ -22,9 +22,9 @@ public class DamageDealtStatTracker extends StatTracker<Game>
if (damager == null)
return;
getGame().AddStat(damager, "Damage Dealt", (int) Math.round(event.GetDamage()), false, false);
addStat(damager, "Damage Dealt", (int) Math.round(event.GetDamage()), false, false);
if (getGame().GetKit(damager) != null)
getGame().AddStat(damager, getGame().GetKit(damager).GetName() + " Damage Dealt", (int) Math.round(event.GetDamage()), false, false);
addStat(damager, getGame().GetKit(damager).GetName() + " Damage Dealt", (int) Math.round(event.GetDamage()), false, false);
}
}

View File

@ -22,9 +22,9 @@ public class DamageTakenStatTracker extends StatTracker<Game>
if (damagee == null)
return;
getGame().AddStat(damagee, "Damage Taken", (int) Math.round(event.GetDamage()), false, false);
addStat(damagee, "Damage Taken", (int) Math.round(event.GetDamage()), false, false);
if (getGame().GetKit(damagee) != null)
getGame().AddStat(damagee, getGame().GetKit(damagee).GetName() + " Damage Taken", (int) Math.round(event.GetDamage()), false, false);
addStat(damagee, getGame().GetKit(damagee).GetName() + " Damage Taken", (int) Math.round(event.GetDamage()), false, false);
}
}

View File

@ -58,7 +58,7 @@ public class DeathBomberStatTracker extends StatTracker<Game>
_killCount.put(killer.getUniqueId(), count);
if (count >= 5)
getGame().AddStat(killer, "DeathBomber", 1, true, false);
addStat(killer, "DeathBomber", 1, true, false);
}
}
}

View File

@ -31,9 +31,9 @@ public class DeathsStatTracker extends StatTracker<Game>
if (player == null)
return;
getGame().AddStat(player, "Deaths", 1, false, false);
addStat(player, "Deaths", 1, false, false);
if (getGame().GetKit(player) != null)
getGame().AddStat(player, getGame().GetKit(player).GetName() + " Deaths", 1, false, false);
addStat(player, getGame().GetKit(player).GetName() + " Deaths", 1, false, false);
}
}

View File

@ -18,6 +18,6 @@ public class ElectrocutionStatTracker extends StatTracker<Game>
return;
if (event.getStruck().size() >= 4)
getGame().AddStat(event.getPlayer(), "MassElectrocution", 1, true, false);
addStat(event.getPlayer(), "MassElectrocution", 1, true, false);
}
}

View File

@ -79,7 +79,7 @@ public class FastKillsStatTracker extends StatTracker<Game>
_lastKillTime.remove(player.getUniqueId());
if (killCount >= getRequiredKillCount())
getGame().AddStat(killer, getStat(), 1, true, false);
addStat(killer, getStat(), 1, true, false);
}
public int getRequiredKillCount()

View File

@ -21,7 +21,7 @@ public class FirstSupplyDropOpenStatTracker extends StatTracker<Game>
if (first)
{
getGame().AddStat(event.getPlayer(), "SupplyDropsOpened", 1, false, false);
addStat(event.getPlayer(), "SupplyDropsOpened", 1, false, false);
first = false;
}

View File

@ -42,6 +42,6 @@ public class FoodForTheMassesStatTracker extends StatTracker<Game>
return;
if (event.GetLog().GetLastDamager().GetReason() != null && event.GetLog().GetLastDamager().GetReason().equalsIgnoreCase("Apple Thrower"))
getGame().AddStat(killer, "FoodForTheMasses", 1, false, false);
addStat(killer, "FoodForTheMasses", 1, false, false);
}
}

View File

@ -31,7 +31,7 @@ public class FreeKitWinStatTracker extends StatTracker<Game>
if (getGame().GetKit(winner) != null)
{
if (getGame().GetKit(winner).GetAvailability() == KitAvailability.Free)
getGame().AddStat(winner, "FreeKitsForever", 1, false, false);
addStat(winner, "FreeKitsForever", 1, false, false);
}
}
}

View File

@ -57,7 +57,7 @@ public class HunterKillerStatTracker extends StatTracker<Game>
_huntersKilled.put(killer.getUniqueId(), huntersKilled);
if (huntersKilled >= 10)
getGame().AddStat(killer, "HunterKiller", 1, true, false);
addStat(killer, "HunterKiller", 1, true, false);
}
}
}

View File

@ -58,7 +58,7 @@ public class HunterOfTheYearStatTracker extends StatTracker<Game>
_hidersKilled.put(killer.getUniqueId(), hidersKilled);
if (hidersKilled >= 7)
getGame().AddStat(killer, "HunterOfTheYear", 1, true, false);
addStat(killer, "HunterOfTheYear", 1, true, false);
}
}
}

View File

@ -45,7 +45,7 @@ public class KeenEyeStatTracker extends StatTracker<Draw>
if (event.GetState() == Game.GameState.End)
{
for (Player player : _guessAll)
getGame().AddStat(player, "KeenEye", 1, true, false);
addStat(player, "KeenEye", 1, true, false);
}
}
}

View File

@ -85,7 +85,7 @@ public class KillAllOpposingStatTracker extends StatTracker<TeamGame>
}
if (killedAll)
getGame().AddStat(player, "Ace", 1, true, false);
addStat(player, "Ace", 1, true, false);
}
}
}

View File

@ -31,9 +31,9 @@ public class KillsStatTracker extends StatTracker<Game>
if (player == null)
return;
getGame().AddStat(player, "Kills", 1, false, false);
addStat(player, "Kills", 1, false, false);
if (getGame().GetKit(player) != null)
getGame().AddStat(player, getGame().GetKit(player).GetName() + " Kills", 1, false, false);
addStat(player, getGame().GetKit(player).GetName() + " Kills", 1, false, false);
}
}

View File

@ -58,7 +58,7 @@ public class KillsWithinTimeLimitStatTracker extends StatTracker<Game>
_kills.put(player.getUniqueId(), killCount);
if (killCount == getKillCount() && System.currentTimeMillis() - getGame().GetStateTime() < getTimeLimit())
getGame().AddStat(player, getStat(), 1, true, false);
addStat(player, getStat(), 1, true, false);
}
public String getStat()

View File

@ -47,7 +47,7 @@ public class KingDamageStatTracker extends StatTracker<CastleSiege>
Double damage = _kingDamage.get(player.getUniqueId());
if (damage != null && damage >= 0.5 * _totalKingDamage)
getGame().AddStat(player, "Assassin", 1, true, false);
addStat(player, "Assassin", 1, true, false);
}
}
}

View File

@ -18,6 +18,6 @@ public class KingSlayerStatTracker extends StatTracker<Game>
if (getGame().GetState() != Game.GameState.Live)
return;
getGame().AddStat(event.getPlayer(), "KingSlayer", 1, true, false);
addStat(event.getPlayer(), "KingSlayer", 1, true, false);
}
}

View File

@ -58,7 +58,7 @@ public class LastStandStatTracker extends StatTracker<TeamGame>
_kills.put(killer.getUniqueId(), kills);
if (kills >= 3)
getGame().AddStat(killer, "LastStand", 1, true, false);
addStat(killer, "LastStand", 1, true, false);
}
}
}

View File

@ -27,10 +27,10 @@ public class LoseStatTracker extends StatTracker<Game>
{
for (Player loser : losers)
{
getGame().AddStat(loser, "Losses", 1, false, false);
addStat(loser, "Losses", 1, false, false);
if (getGame().GetKit(loser) != null)
getGame().AddStat(loser, getGame().GetKit(loser).GetName() + " Losses", 1, false, false);
addStat(loser, getGame().GetKit(loser).GetName() + " Losses", 1, false, false);
}
}
}

View File

@ -19,6 +19,6 @@ public class MedicStatTracker extends StatTracker<Game>
if (getGame().GetState() != Game.GameState.Live)
return;
getGame().AddStat(event.getPlayer(), "Medic", 1, false, false);
addStat(event.getPlayer(), "Medic", 1, false, false);
}
}

View File

@ -32,6 +32,6 @@ public class MeowStatTracker extends StatTracker<Game>
_meowCount.put(event.getPlayer().getUniqueId(), meows);
if (meows >= 50)
getGame().AddStat(event.getPlayer(), "Meow", 1, true, false);
addStat(event.getPlayer(), "Meow", 1, true, false);
}
}

View File

@ -58,7 +58,7 @@ public class MrSquiggleStatTracker extends StatTracker<Draw>
}
if (!greaterThan15000)
getGame().AddStat(drawer, "MrSquiggle", 1, true, false);
addStat(drawer, "MrSquiggle", 1, true, false);
}
}
}

View File

@ -72,7 +72,7 @@ public class OneVThreeStatTracker extends StatTracker<Game>
Integer killCount = _killCount.get(player.getUniqueId());
if (killCount != null && killCount >= 10)
getGame().AddStat(player, "1v3", 1, true, false);
addStat(player, "1v3", 1, true, false);
}
}
}

View File

@ -41,7 +41,7 @@ public class ParalympicsStatTracker extends StatTracker<Game>
for (Player winner : winners)
{
if (!_hasLeaped.contains(winner.getUniqueId()))
getGame().AddStat(winner, "Paralympics", 1, true, false);
addStat(winner, "Paralympics", 1, true, false);
}
}
}

View File

@ -21,6 +21,6 @@ public class PureLuckStatTracker extends StatTracker<Draw>
return;
if (System.currentTimeMillis() - event.getDrawRound().Time < 5000)
getGame().AddStat(event.getPlayer(), "PureLuck", 1, true, false);
addStat(event.getPlayer(), "PureLuck", 1, true, false);
}
}

View File

@ -58,6 +58,6 @@ public class RecoveryMasterStatTracker extends StatTracker<Game>
_damageTaken.put(damagee.getUniqueId(), damage);
if (damage >= 200)
getGame().AddStat(damagee, "RecoveryMaster", 1, true, false);
addStat(damagee, "RecoveryMaster", 1, true, false);
}
}

View File

@ -18,6 +18,6 @@ public class SeismicSlamStatTracker extends StatTracker<Game>
return;
if (event.getTargets().size() >= 5)
getGame().AddStat(event.getPlayer(), "Earthquake", 1, true, false);
addStat(event.getPlayer(), "Earthquake", 1, true, false);
}
}

View File

@ -61,7 +61,7 @@ public class SharpShooterStatTracker extends StatTracker<Game>
Integer arrowsShot = _arrowsShot.get(player.getUniqueId());
if (arrowsShot != null && arrowsShot == 8)
getGame().AddStat(player, "Sharpshooter", 1, true, false);
addStat(player, "Sharpshooter", 1, true, false);
}
}
}

View File

@ -19,6 +19,6 @@ public class SheepDropStatTracker extends StatTracker<Game>
if (getGame().GetState() != Game.GameState.Live)
return;
getGame().AddStat(event.getPlayer(), "AnimalRescue", 1, false, false);
addStat(event.getPlayer(), "AnimalRescue", 1, false, false);
}
}

View File

@ -19,6 +19,6 @@ public class SheepThiefStatTracker extends StatTracker<Game>
if (getGame().GetState() != Game.GameState.Live)
return;
getGame().AddStat(event.getPlayer(), "Thief", 1, false, false);
addStat(event.getPlayer(), "Thief", 1, false, false);
}
}

View File

@ -37,7 +37,7 @@ public class SimultaneousSkeletonStatTracker extends StatTracker<Game>
}
if (aliveCount >= getRequiredCount())
getGame().AddStat(event.getPlayer(), "Skeletons", 1, true, false);
addStat(event.getPlayer(), "Skeletons", 1, true, false);
}
}

View File

@ -32,6 +32,6 @@ public class SlimySheepStatTracker extends StatTracker<Game>
_count.put(event.getPlayer().getUniqueId(), count);
if (count >= 20)
getGame().AddStat(event.getPlayer(), "SlimySheep", 1, true, false);
addStat(event.getPlayer(), "SlimySheep", 1, true, false);
}
}

View File

@ -19,6 +19,6 @@ public class SparklezStatTracker extends StatTracker<Game>
if (getGame().GetState() != Game.GameState.Live)
return;
getGame().AddStat(event.getPlayer(), "Sparklez", 1, false, false);
addStat(event.getPlayer(), "Sparklez", 1, false, false);
}
}

View File

@ -19,6 +19,6 @@ public class SpleefBlockDestroyStatTracker extends StatTracker<Game>
if (getGame().GetState() != Game.GameState.Live)
return;
getGame().AddStat(event.getPlayer(), "SpleefBlocks", 1, false, false);
addStat(event.getPlayer(), "SpleefBlocks", 1, false, false);
}
}

View File

@ -1,7 +1,9 @@
package nautilus.game.arcade.stats;
import nautilus.game.arcade.game.*;
import org.bukkit.event.*;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import nautilus.game.arcade.game.Game;
public class StatTracker<G extends Game> implements Listener
{
@ -16,4 +18,15 @@ public class StatTracker<G extends Game> implements Listener
{
return game;
}
public boolean canAddStats()
{
return getGame().GetPlayers(false).size() * 4 >= 3 * getGame().Manager.GetPlayerFull();
}
public void addStat(Player player, String stat, int value, boolean limitTo1, boolean global)
{
if (canAddStats())
addStat(player, stat, value, limitTo1, global);
}
}

View File

@ -38,6 +38,6 @@ public class TeamDeathsStatTracker extends StatTracker<Game>
GameTeam team = getGame().GetTeam(player);
if (team != null && team.GetName() != null)
getGame().AddStat(player, team.GetName() + " Deaths", 1, false, false);
addStat(player, team.GetName() + " Deaths", 1, false, false);
}
}

View File

@ -38,6 +38,6 @@ public class TeamKillsStatTracker extends StatTracker<Game>
GameTeam team = getGame().GetTeam(player);
if (team != null && team.GetName() != null)
getGame().AddStat(player, team.GetName() + " Kills", 1, false, false);
addStat(player, team.GetName() + " Kills", 1, false, false);
}
}

View File

@ -47,7 +47,7 @@ public class TheComebackStatTracker extends StatTracker<TurfForts>
if (_hasWentFiveOrBelow.contains(getGame().WinnerTeam))
{
for (Player player : getGame().getWinners())
getGame().AddStat(player, "TheComeback", 1, true, false);
addStat(player, "TheComeback", 1, true, false);
}
}
}

View File

@ -54,7 +54,7 @@ public class TheLongestShotStatTracker extends StatTracker<Game>
Arrow arrow = (Arrow) edbee.getDamager();
if (arrow.getShooter() == killer && killer.getLocation().distanceSquared(player.getLocation()) <= 64 * 64)
getGame().AddStat(killer, "TheLongestShot", 1, false, false);
addStat(killer, "TheLongestShot", 1, false, false);
}
}
}

View File

@ -17,6 +17,6 @@ public class TntMinerStatTracker extends StatTracker<Game>
if (getGame().GetState() != Game.GameState.Live)
return;
getGame().AddStat(event.getPlayer(), "FortuneBomber", 1, false, false);
addStat(event.getPlayer(), "FortuneBomber", 1, false, false);
}
}

View File

@ -41,7 +41,7 @@ public class WinAsTeamStatTracker extends StatTracker<TeamGame>
if (winners != null)
{
for (Player winner : winners)
getGame().AddStat(winner, _stat, 1, false, false);
addStat(winner, _stat, 1, false, false);
}
}
}

View File

@ -37,7 +37,7 @@ public class WinFastStatTracker extends StatTracker<Game>
if (winners != null)
{
for (Player winner : winners)
getGame().AddStat(winner, getStat(), 1, true, false);
addStat(winner, getStat(), 1, true, false);
}
}
}

View File

@ -26,7 +26,7 @@ public class WinMapStatTracker extends StatTracker<Game>
if (winners != null)
{
for (Player winner : winners)
getGame().AddStat(winner, "Win." + getGame().WorldData.MapName, 1, true, false);
addStat(winner, "Win." + getGame().WorldData.MapName, 1, true, false);
}
}
}

View File

@ -27,10 +27,10 @@ public class WinStatTracker extends StatTracker<Game>
{
for (Player winner : winners)
{
getGame().AddStat(winner, "Wins", 1, false, false);
addStat(winner, "Wins", 1, false, false);
if (getGame().GetKit(winner) != null)
getGame().AddStat(winner, getGame().GetKit(winner).GetName() + " Wins", 1, false, false);
addStat(winner, getGame().GetKit(winner).GetName() + " Wins", 1, false, false);
}
}
}

View File

@ -29,7 +29,7 @@ public class WinWithSheepStatTracker extends StatTracker<SheepGame>
if (winners != null)
{
for (Player winner : winners)
getGame().AddStat(winner, "Selfish", 1, true, false);
addStat(winner, "Selfish", 1, true, false);
}
}
}

View File

@ -57,7 +57,7 @@ public class WinWithoutDyingStatTracker extends StatTracker<Game>
for (Player winner : winners)
{
if (!_hasDied.contains(winner.getUniqueId()))
getGame().AddStat(winner, getStat(), 1, true, false);
addStat(winner, getStat(), 1, true, false);
}
}
}

View File

@ -28,7 +28,7 @@ public class WinWithoutLosingTeammateStatTracker extends StatTracker<TeamGame>
if (winner.GetPlayers(true).size() == winner.GetPlayers(false).size())
{
for (Player player : winner.GetPlayers(true))
getGame().AddStat(player, getStat(), 1, true, false);
addStat(player, getStat(), 1, true, false);
}
}
}

View File

@ -58,7 +58,7 @@ public class WinWithoutWearingArmorStatTracker extends StatTracker<Game>
for (Player winner : winners)
{
if (!_armorWearers.contains(winner.getUniqueId()))
getGame().AddStat(winner, "NoArmor", 1, true, false);
addStat(winner, "NoArmor", 1, true, false);
}
}
}