More scoreboard stuff (TDM)

New Tug game
This commit is contained in:
Mini-Chiss 2014-07-01 18:30:04 -07:00
parent 7bc3966feb
commit 31772196a9
12 changed files with 670 additions and 62 deletions

View File

@ -544,6 +544,11 @@ public class UtilEnt
}
public static boolean CreatureMoveFast(Entity ent, Location target, float speed)
{
return CreatureMoveFast(ent, target, speed, true);
}
public static boolean CreatureMoveFast(Entity ent, Location target, float speed, boolean slow)
{
if (!(ent instanceof Creature))
return false;

View File

@ -85,9 +85,9 @@ public class UtilTime
if (trim == 0)
{
if (type == TimeUnit.DAYS) return (int)UtilMath.trim(trim, (time)/86400000d) + " Days";
if (type == TimeUnit.HOURS) return (int)UtilMath.trim(trim, (time)/3600000d) + " Hours";
if (type == TimeUnit.MINUTES) return (int)UtilMath.trim(trim, (time)/60000d) + " Minutes";
if (type == TimeUnit.DAYS) return UtilMath.trim(trim, (time)/86400000d) + " Days";
if (type == TimeUnit.HOURS) return UtilMath.trim(trim, (time)/3600000d) + " Hours";
if (type == TimeUnit.MINUTES) return UtilMath.trim(trim, (time)/60000d) + " Minutes";
if (type == TimeUnit.SECONDS) return (int)UtilMath.trim(trim, (time)/1000d) + " Seconds";
else return (int)UtilMath.trim(trim, time) + " Milliseconds";
}

View File

@ -41,6 +41,7 @@ import nautilus.game.arcade.game.games.stacker.Stacker;
import nautilus.game.arcade.game.games.survivalgames.SurvivalGames;
import nautilus.game.arcade.game.games.survivalgames.SurvivalGamesTeams;
import nautilus.game.arcade.game.games.paintball.Paintball;
import nautilus.game.arcade.game.games.tug.Tug;
import nautilus.game.arcade.game.games.turfforts.TurfForts;
import nautilus.game.arcade.game.games.uhc.UHC;
import nautilus.game.arcade.game.games.zombiesurvival.ZombieSurvival;
@ -92,6 +93,7 @@ public class GameFactory
else if (gameType == GameType.Stacker) return new Stacker(_manager);
else if (gameType == GameType.SurvivalGames) return new SurvivalGames(_manager);
else if (gameType == GameType.SurvivalGamesTeams) return new SurvivalGamesTeams(_manager);
else if (gameType == GameType.Tug) return new Tug(_manager);
else if (gameType == GameType.TurfWars) return new TurfForts(_manager);
else if (gameType == GameType.UHC) return new UHC(_manager);
else if (gameType == GameType.ZombieSurvival) return new ZombieSurvival(_manager);

View File

@ -42,6 +42,7 @@ public enum GameType
SpleefTeams("Super Spleef Teams"),
Stacker("Super Stacker"),
SquidShooter("Squid Shooter"),
Tug("Tug of Wool"),
TurfWars("Turf Wars"),
UHC("Ultra Hardcore"),
ZombieSurvival("Zombie Survival");

View File

@ -52,13 +52,9 @@ public class TeamDeathmatch extends TeamGame
private Objective _healthObj;
private boolean _beaconEnabled = false;
private CapturePointTDM _beacon = null;
private long _beaconTime = 180000;
//Scores
private int _victoryScore = 120;
private int _redScore = 0;
private int _blueScore = 0;
public TeamDeathmatch(ArcadeManager manager, GameType type, Kit[] kits)
{
@ -216,16 +212,18 @@ public class TeamDeathmatch extends TeamGame
if (event.getType() != UpdateType.TICK)
return;
if (_beaconEnabled)
if (_beacon != null)
return;
if (UtilTime.elapsed(GetStateTime(), _beaconTime))
{
_beaconEnabled = true;
_beacon = _points.get(UtilMath.r(_points.size()));
Announce(C.cWhite + C.Bold + "Capture Point is active!");
_points.get(UtilMath.r(_points.size())).Enable();
_beacon.Enable();
Announce(C.cWhite + C.Bold + _beacon.GetName() + " Capture Point is active!");
for (Player player : UtilServer.getPlayers())
player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1f, 1f);
@ -249,11 +247,20 @@ public class TeamDeathmatch extends TeamGame
for (GameTeam team : this.GetTeamList())
{
//Display Individual Players
if (this.GetPlayers(true).size() < 10)
if (this.GetPlayers(false).size() < 10)
{
Scoreboard.WriteBlank();
for (Player player : team.GetPlayers(true))
{
Scoreboard.Write(team.GetColor() + player.getName());
int kills = 0;
if (_kills.containsKey(player))
kills = _kills.get(player);
if (IsAlive(player))
Scoreboard.Write(kills + " " + team.GetColor() + player.getName());
else
Scoreboard.Write(kills + " " + C.cGray + player.getName());
}
}
@ -262,59 +269,36 @@ public class TeamDeathmatch extends TeamGame
{
Scoreboard.WriteBlank();
Scoreboard.Write(team.GetColor() + team.GetName() + " Alive");
Scoreboard.Write("" + team.GetPlayers(true).size());
Scoreboard.Write(team.GetColor() + team.GetName() + " Team");
Scoreboard.Write("" + team.GetPlayers(true).size() + team.GetColor() + "Alive");
}
}
if (_beaconEnabled)
if (_beacon != null)
{
Scoreboard.WriteBlank();
Scoreboard.Write(C.cYellow + C.Bold + " Beacon");
Scoreboard.Write(C.cRed + _redScore + C.cWhite + " " + C.cAqua + _blueScore);
Scoreboard.Write(C.cYellow + C.Bold + _beacon.GetName());
Scoreboard.Write(_beacon.GetOwnership());
}
else
{
long timeLeft = _beaconTime - (System.currentTimeMillis() - GetStateTime());
Scoreboard.WriteBlank();
Scoreboard.Write(C.cYellow + C.Bold + " Beacon Spawn");
Scoreboard.Write(C.cYellow + C.Bold + "Beacon");
Scoreboard.Write(UtilTime.MakeStr(timeLeft, 0));
}
Scoreboard.Draw();
}
public void AddScore(GameTeam team, int score)
{
if (team == null)
return;
if (team.GetColor() == ChatColor.RED)
{
_redScore = Math.min(_victoryScore, _redScore + score);
}
else
{
_blueScore = Math.min(_victoryScore, _blueScore + score);
}
EndCheckScore();
}
public void EndCheckScore()
{
if (!IsLive())
return;
GameTeam winner = null;
if (_redScore >= _victoryScore)
winner = GetTeam(ChatColor.RED);
else if (_blueScore >= _victoryScore)
winner = GetTeam(ChatColor.AQUA);
GameTeam winner = _beacon.GetWinner();
if (winner == null)
return;

View File

@ -31,9 +31,13 @@ public class CapturePointTDM
private int _indicatorTick = 0;
private boolean _enabled = false;
private GameTeam _captureTeam = null;
private int _captureAmount = 0;
private int _captureMax = 60;
public CapturePointTDM(TeamDeathmatch host, String name, Location loc)
{
@ -56,20 +60,20 @@ public class CapturePointTDM
//Floors
if (Math.abs(x) <= 2 && Math.abs(z) <= 2)
{
Block floor = loc.getBlock().getRelative(x, -2, z);
floor.setType(Material.WOOL);
_floor.add(floor);
}
//Glass
if (Math.abs(x) <= 2 && Math.abs(z) <= 2)
{
Block block = loc.getBlock().getRelative(x, -1, z);
block.setType(Material.GLASS);
}
//Iron
if (Math.abs(x) <= 1 && Math.abs(z) <= 1)
{
@ -104,7 +108,7 @@ public class CapturePointTDM
{
if (player.getGameMode() != GameMode.SURVIVAL)
continue;
if (Math.abs(_loc.getX() - player.getLocation().getX()) > 2.5)
continue;
@ -130,7 +134,7 @@ public class CapturePointTDM
//Capture
if (teamB == null && teamA != null)
Capture(teamA, playersA.size(), playersA);
else if (teamA == null && teamB != null)
Capture(teamB, playersB.size(), playersB);
@ -145,10 +149,27 @@ public class CapturePointTDM
{
if (team == null)
return;
if (_captureTeam == null)
SetTeam(team);
if (_captureTeam.equals(team))
{
_captureAmount = Math.min(_captureMax, (_captureAmount + 1));
}
else
{
_captureAmount = Math.max(0, (_captureAmount - 1));
if (_captureAmount == 0)
{
SetTeam(team);
}
}
//Score Add
Host.AddScore(team, 1);
Host.EndCheckScore();
//Color
Color color = Color.BLUE;
if (team.GetColor() == ChatColor.RED)
@ -157,6 +178,27 @@ public class CapturePointTDM
Indicate(color);
}
public void SetTeam(GameTeam team)
{
_captureTeam = team;
for (Block block : _floor)
{
if (team.GetColor() == ChatColor.RED)
block.setData((byte) 14);
else
block.setData((byte) 11);
}
for (Block block : _indicators)
{
if (team.GetColor() == ChatColor.RED)
block.setData((byte) 14);
else
block.setData((byte) 11);
}
}
public void Firework(Location loc, Color color, boolean major)
{
if (!major)
@ -173,18 +215,42 @@ public class CapturePointTDM
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, 152);
else
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, 22);
//for (Block block : _indicators)
//Firework(_indicators.get(_indicatorTick).getLocation().add(0.5, 0.5, 0.5), color, false);
_indicatorTick = (_indicatorTick + 1)%_indicators.size();
}
public void Enable()
{
Block block = _loc.getBlock().getRelative(0, -2, 0);
block.setType(Material.BEACON);
_enabled = true;
}
public String GetName()
{
return _name;
}
public String GetOwnership()
{
if (_captureTeam != null)
return _captureTeam.GetColor() + "" + _captureAmount + "/" + _captureMax;
return "0/" + _captureMax;
}
public GameTeam GetWinner()
{
if (_captureTeam == null)
return null;
if (_captureAmount >= _captureMax)
return _captureTeam;
return null;
}
}

View File

@ -0,0 +1,341 @@
package nautilus.game.arcade.game.games.tug;
import java.util.ArrayList;
import java.util.Iterator;
import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.Effect;
import org.bukkit.FireworkEffect;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Creature;
import org.bukkit.entity.Pig;
import org.bukkit.entity.Player;
import org.bukkit.entity.Sheep;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityChangeBlockEvent;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.EntityInteractEvent;
import org.bukkit.event.entity.EntityTargetEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilWorld;
import mineplex.core.timing.TimingManager;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.TeamGame;
import nautilus.game.arcade.game.games.tug.kits.*;
import nautilus.game.arcade.kit.Kit;
public class Tug extends TeamGame
{
private ArrayList<Location> _redMobs;
private ArrayList<Location> _blueMobs;
private ArrayList<Block> _redLives = new ArrayList<Block>();
private ArrayList<Block> _blueLives = new ArrayList<Block>();
private ArrayList<TugCreature> _redCreatures = new ArrayList<TugCreature>();
private ArrayList<TugCreature> _blueCreatures = new ArrayList<TugCreature>();
public Tug(ArcadeManager manager)
{
super(manager, GameType.Tug,
new Kit[]
{
new KitSmasher(manager),
new KitArcher(manager),
},
new String[]
{
"Your animals are hungry",
"Guide them to enemy crops",
"Eat all enemy crops to win!"
});
this.HungerSet = 20;
this.DeathOut = false;
this.DeathSpectateSecs = 20;
}
@Override
public void ParseData()
{
_redMobs = WorldData.GetDataLocs("RED");
for (Location loc : WorldData.GetDataLocs("PINK"))
{
_redLives.add(loc.getBlock());
loc.getBlock().getRelative(BlockFace.DOWN).setTypeIdAndData(60, (byte)0, true);
loc.getBlock().setTypeIdAndData(59, (byte)7, true);
}
_blueMobs = WorldData.GetDataLocs("BLUE");
for (Location loc : WorldData.GetDataLocs("LIGHT_BLUE"))
{
_blueLives.add(loc.getBlock());
loc.getBlock().getRelative(BlockFace.DOWN).setTypeIdAndData(60, (byte)0, true);
loc.getBlock().setTypeIdAndData(141, (byte)7, true);
}
}
@EventHandler
public void CreatureTarget(EntityTargetEvent event)
{
event.setCancelled(true);
}
/*
@EventHandler
public void LivesFix(UpdateEvent event)
{
if (!IsLive())
return;
if (event.getType() != UpdateType.TICK)
return;
for (Block block : _redLives)
{
if (block.getTypeId() != 59)
{
block.getRelative(BlockFace.DOWN).setTypeIdAndData(60, (byte)0, true);
block.setTypeIdAndData(59, (byte)7, true);
}
}
for (Block block : _blueLives)
{
if (block.getTypeId() != 141)
{
block.getRelative(BlockFace.DOWN).setTypeIdAndData(60, (byte)0, true);
block.setTypeIdAndData(141, (byte)7, true);
}
}
}
*/
@EventHandler
public void CreatureUpdate(UpdateEvent event)
{
if (!IsLive())
return;
if (event.getType() == UpdateType.FAST)
{
if (_redCreatures.size() < 30)
{
this.CreatureAllowOverride = true;
Location loc = UtilAlg.Random(_redMobs);
Creature ent = loc.getWorld().spawn(loc, Pig.class);
ent.setMaxHealth(10);
ent.setHealth(10);
this.CreatureAllowOverride = false;
_redCreatures.add(new TugCreature(this, ent, _blueLives));
}
if (_blueCreatures.size() < 30)
{
this.CreatureAllowOverride = true;
Location loc = UtilAlg.Random(_blueMobs);
Creature ent = loc.getWorld().spawn(loc, Sheep.class);
ent.setMaxHealth(10);
ent.setHealth(10);
this.CreatureAllowOverride = false;
_blueCreatures.add(new TugCreature(this, ent, _redLives));
}
}
if (event.getType() == UpdateType.TICK)
{
//TimingManager.start("Creature Move");
//Target
for (TugCreature ent : _redCreatures)
{
ent.Move(_blueLives);
}
//Target
for (TugCreature ent : _blueCreatures)
{
ent.Move(_redLives);
}
//TimingManager.stop("Creature Move");
}
else if (event.getType() == UpdateType.FAST)
{
//Target
for (TugCreature ent : _redCreatures)
{
ent.FindTarget(_blueCreatures, GetTeam(ChatColor.AQUA).GetPlayers(true));
}
//Target
for (TugCreature ent : _blueCreatures)
{
ent.FindTarget(_redCreatures, GetTeam(ChatColor.RED).GetPlayers(true));
}
//Eat
Eat(_redCreatures, _blueLives);
Eat(_blueCreatures, _redLives);
}
}
public void Eat(ArrayList<TugCreature> ents, ArrayList<Block> lives)
{
Iterator<TugCreature> entIterator = ents.iterator();
while (entIterator.hasNext())
{
TugCreature ent = entIterator.next();
if (!ent.Entity.isValid())
{
ent.Entity.remove();
entIterator.remove();
continue;
}
Iterator<Block> blockIterator = lives.iterator();
while (blockIterator.hasNext())
{
Block block = blockIterator.next();
if (UtilMath.offset(ent.Entity.getLocation(), block.getLocation().add(0.5, 0, 0.5)) < 1)
{
blockIterator.remove();
entIterator.remove();
//Effect
ent.Entity.getWorld().playSound(ent.Entity.getLocation(), Sound.EAT, 2f, 1f);
ent.Entity.getWorld().playSound(ent.Entity.getLocation(), Sound.EAT, 2f, 1f);
ent.Entity.remove();
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId());
block.setType(Material.AIR);
//Firework
if (ent instanceof Pig)
UtilFirework.playFirework(block.getLocation().add(0.5, 0.5, 0.5),
FireworkEffect.builder().flicker(false).withColor(Color.AQUA).with(Type.BURST).trail(true).build());
else
UtilFirework.playFirework(block.getLocation().add(0.5, 0.5, 0.5),
FireworkEffect.builder().flicker(false).withColor(Color.RED).with(Type.BURST).trail(true).build());
EndLivesCheck();
break;
}
}
}
}
public void EndLivesCheck()
{
if (_redLives.isEmpty())
{
AnnounceEnd(GetTeam(ChatColor.AQUA));
SetState(GameState.End);
}
else if (_blueLives.isEmpty())
{
AnnounceEnd(GetTeam(ChatColor.RED));
SetState(GameState.End);
}
}
@EventHandler(priority = EventPriority.LOWEST)
public void CropTrample(PlayerInteractEvent event)
{
if (event.getAction() != Action.PHYSICAL)
return;
if (event.getPlayer().getLocation().getBlock().getRelative(BlockFace.DOWN).getType() != Material.SOIL)
return;
event.setCancelled(true);
}
@EventHandler(priority = EventPriority.LOWEST)
public void CropTrample(EntityInteractEvent event)
{
if (event.getBlock() == null)
return;
System.out.println(event.getBlock().getType());
if (event.getBlock().getType() != Material.SOIL)
return;
event.setCancelled(true);
}
@EventHandler(priority = EventPriority.LOWEST)
public void CropTrample(EntityChangeBlockEvent event)
{
event.setCancelled(true);
}
@EventHandler
public void CreatureDeath(EntityDeathEvent event)
{
event.getDrops().clear();
}
@Override
@EventHandler
public void ScoreboardUpdate(UpdateEvent event)
{
if (event != null && event.getType() != UpdateType.FAST)
return;
ScoreboardWrite();
}
public void ScoreboardWrite()
{
Scoreboard.Reset();
Scoreboard.WriteBlank();
Scoreboard.Write(C.cRed + "Pig Team");
Scoreboard.Write(_redLives.size() + " Wheat");
Scoreboard.WriteBlank();
Scoreboard.Write(C.cAqua + "Sheep Team");
Scoreboard.Write(_blueLives.size() + " Carrots");
Scoreboard.Draw();
}
}

View File

@ -0,0 +1,107 @@
package nautilus.game.arcade.game.games.tug;
import java.util.ArrayList;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilTime;
import nautilus.game.arcade.game.Game;
import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.entity.Creature;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityTargetEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
public class TugCreature
{
public Game Host;
public Creature Entity;
public LivingEntity Target;
public Block Destination;
public long lastAttack = 0;
public TugCreature(Game host, Creature ent, ArrayList<Block> lives)
{
Host = host;
Entity = ent;
Move(lives);
}
public void Move(ArrayList<Block> lives)
{
if (Destination == null || !lives.contains(Destination))
{
Destination = UtilAlg.Random(lives);
}
if (Target != null)
{
if (UtilMath.offset(Entity, Target) < 2 && UtilTime.elapsed(lastAttack, 400))
{
//Damage Event
Host.Manager.GetDamage().NewDamageEvent(Target, Entity, null,
DamageCause.ENTITY_ATTACK, 3, true, false, false,
UtilEnt.getName(Entity), "Headbutt");
lastAttack = System.currentTimeMillis();
}
if (UtilMath.offset(Entity, Target) > 1)
{
UtilEnt.CreatureMoveFast(Entity, Target.getLocation().add(UtilAlg.getTrajectory2d(Target, Entity).multiply(1.5)), 1.5f, false);
}
}
else
{
Location loc = Destination.getLocation().add(0.5, 0, 0.5);
UtilEnt.CreatureMoveFast(Entity, loc.add(UtilAlg.getTrajectory2d(loc, Entity.getLocation()).multiply(0.5)), 1.5f, false);
}
}
public void FindTarget(ArrayList<TugCreature> mobs, ArrayList<Player> enemyPlayers)
{
if (Target == null || !Target.isValid() || UtilMath.offset(Target, Entity) > 6)
{
Target = null;
double bestDist = 0;
for (TugCreature mob : mobs)
{
double dist = UtilMath.offset(mob.Entity, Entity);
if (Target == null || dist < bestDist)
{
Target = mob.Entity;
bestDist = dist;
}
}
/*
for (Player player : enemyPlayers)
{
double dist = UtilMath.offset(player, Entity);
if (Target == null || dist < bestDist)
{
Target = player;
bestDist = dist;
}
}
*/
if (Target == null || !Target.isValid() || UtilMath.offset(Target, Entity) > 4)
{
Target = null;
}
}
}
}

View File

@ -0,0 +1,47 @@
package nautilus.game.arcade.game.games.tug.kits;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.*;
public class KitArcher extends Kit
{
public KitArcher(ArcadeManager manager)
{
super(manager, "Archer", KitAvailability.Free,
new String[]
{
"Passively crafts arrows from surrounding terrain."
},
new Perk[]
{
new PerkFletcher(20, 3, true),
new PerkBarrage(5, 250, true, false),
},
EntityType.ZOMBIE,
new ItemStack(Material.BOW));
}
@Override
public void GiveItems(Player player)
{
player.getInventory().addItem(new ItemStack(Material.STONE_SWORD));
player.getInventory().addItem(new ItemStack(Material.BOW));
player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET));
player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE));
player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS));
player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS));
}
}

View File

@ -0,0 +1,46 @@
package nautilus.game.arcade.game.games.tug.kits;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.*;
public class KitSmasher extends Kit
{
public KitSmasher(ArcadeManager manager)
{
super(manager, "Smasher", KitAvailability.Free,
new String[]
{
"Giant and muscular, easily smacks others around."
},
new Perk[]
{
new PerkMammoth(),
new PerkSeismicSlamHG()
},
EntityType.ZOMBIE,
new ItemStack(Material.IRON_SWORD));
}
@Override
public void GiveItems(Player player)
{
player.getInventory().addItem(new ItemStack(Material.IRON_SWORD));
player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.IRON_HELMET));
player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE));
player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.IRON_LEGGINGS));
player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.IRON_BOOTS));
}
}

View File

@ -366,7 +366,7 @@ public class ZombieSurvival extends SoloGame
Scoreboard.WriteBlank();
Scoreboard.Write(team.GetPlayers(true).size() + " " + team.GetColor() + team.GetName());
}
Scoreboard.Draw();
}

View File

@ -27,17 +27,21 @@ public class GameScoreboard
private ArrayList<ScoreboardElement> _elements = new ArrayList<ScoreboardElement>();
private String _space = " ";
private String _title;
public GameScoreboard(Game game)
{
Game = game;
_title = " MINEPLEX ";
//Scoreboard
_scoreboard = Bukkit.getScoreboardManager().getNewScoreboard();
_sideObjective = _scoreboard.registerNewObjective("Obj"+UtilMath.r(999999999), "dummy");
_sideObjective.setDisplaySlot(DisplaySlot.SIDEBAR);
_sideObjective.setDisplayName(C.Bold + " MINEPLEX ");
_sideObjective.setDisplayName(C.Bold + _title);
}
public Scoreboard GetScoreboard()
@ -50,6 +54,11 @@ public class GameScoreboard
return _sideObjective;
}
public void UpdateTitle()
{
}
public String ParseTeamName(String name)
{
return name.substring(0, Math.min(16, name.length()));