Barbarians stats added + Block break stat tracker added
This commit is contained in:
parent
6a3e9ac19f
commit
3315a510dc
@ -46,7 +46,7 @@ public class BaconBrawl extends SoloGame
|
||||
BlankLine,
|
||||
Assists,
|
||||
DamageDealt,
|
||||
DamageTakenPVP
|
||||
DamageTaken
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -15,6 +15,8 @@ import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.game.SoloGame;
|
||||
import nautilus.game.arcade.game.games.barbarians.kits.*;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.managers.chat.ChatStatData;
|
||||
import nautilus.game.arcade.stats.BlockBreakStat;
|
||||
|
||||
public class Barbarians extends SoloGame
|
||||
{
|
||||
@ -59,7 +61,21 @@ public class Barbarians extends SoloGame
|
||||
this.BlockBreakAllow.add(135);
|
||||
this.BlockBreakAllow.add(136);
|
||||
|
||||
registerChatStats(Kills);
|
||||
registerStatTrackers(
|
||||
new BlockBreakStat(this, true)
|
||||
);
|
||||
|
||||
registerChatStats(
|
||||
Kills,
|
||||
Deaths,
|
||||
KDRatio,
|
||||
BlankLine,
|
||||
Assists,
|
||||
DamageDealt,
|
||||
DamageTaken,
|
||||
BlankLine,
|
||||
new ChatStatData("BlockBreak", "Blocks Broken", true)
|
||||
);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -0,0 +1,63 @@
|
||||
package nautilus.game.arcade.stats;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockDamageEvent;
|
||||
|
||||
import nautilus.game.arcade.game.Game;
|
||||
|
||||
/**
|
||||
* Created by TeddehDev on 15/01/2016.
|
||||
*/
|
||||
public class BlockBreakStat extends StatTracker<Game>
|
||||
{
|
||||
private Game _game;
|
||||
private boolean _blockDamage;
|
||||
|
||||
/**
|
||||
* @param game
|
||||
* @param blockDamage
|
||||
* - true = triggers block damage event
|
||||
* - false = triggers block break event
|
||||
*/
|
||||
public BlockBreakStat(Game game, boolean blockDamage)
|
||||
{
|
||||
super(game);
|
||||
|
||||
_game = game;
|
||||
_blockDamage = blockDamage;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void blockBreak(BlockBreakEvent event)
|
||||
{
|
||||
if(!_game.IsLive())
|
||||
return;
|
||||
|
||||
if(_blockDamage)
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
if(player == null)
|
||||
return;
|
||||
|
||||
addStat(player, "BlocksBroken", 1, false, false);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void blockBreak(BlockDamageEvent event)
|
||||
{
|
||||
if(!_game.IsLive())
|
||||
return;
|
||||
|
||||
if(!_blockDamage)
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
if(player == null)
|
||||
return;
|
||||
|
||||
addStat(player, "BlocksBroken", 1, false, false);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user