Cooldown on Spec Compass

Hub Forcefield Update
Scoreboard MINEPLEX refactor
This commit is contained in:
Mini-Chiss 2014-06-30 16:12:42 -07:00
parent f10b081473
commit 8c461b3e1b
36 changed files with 626 additions and 388 deletions

View File

@ -8,6 +8,5 @@
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Minecraft.Game.Core"/> <classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Minecraft.Game.Core"/>
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/bukkit.jar"/> <classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/bukkit.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Core"/> <classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Core"/>
<classpathentry combineaccessrules="false" kind="src" path="/Nautilus.Core"/>
<classpathentry kind="output" path="bin"/> <classpathentry kind="output" path="bin"/>
</classpath> </classpath>

View File

@ -83,11 +83,25 @@ public class UtilTime
else type = TimeUnit.DAYS; else type = TimeUnit.DAYS;
} }
if (type == TimeUnit.DAYS) return UtilMath.trim(trim, (time)/86400000d) + " Days"; if (trim == 0)
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.DAYS) return (int)UtilMath.trim(trim, (time)/86400000d) + " Days";
if (type == TimeUnit.SECONDS) return UtilMath.trim(trim, (time)/1000d) + " Seconds"; if (type == TimeUnit.HOURS) return (int)UtilMath.trim(trim, (time)/3600000d) + " Hours";
else return UtilMath.trim(trim, time) + " Milliseconds"; if (type == TimeUnit.MINUTES) return (int)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";
}
else
{
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 UtilMath.trim(trim, (time)/1000d) + " Seconds";
else return UtilMath.trim(trim, time) + " Milliseconds";
}
} }
public static boolean elapsed(long from, long required) public static boolean elapsed(long from, long required)

View File

@ -18,7 +18,7 @@ public class TimingManager implements Listener
private static Object _timingLock = new Object(); private static Object _timingLock = new Object();
private static Object _totalLock = new Object(); private static Object _totalLock = new Object();
public static boolean Debug = false; public static boolean Debug = true;
protected TimingManager(JavaPlugin plugin) protected TimingManager(JavaPlugin plugin)
{ {

View File

@ -61,6 +61,7 @@ import mineplex.core.stats.StatsManager;
import mineplex.core.task.TaskManager; import mineplex.core.task.TaskManager;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.hub.commands.ForcefieldRadius;
import mineplex.hub.commands.GadgetToggle; import mineplex.hub.commands.GadgetToggle;
import mineplex.hub.gadget.GadgetManager; import mineplex.hub.gadget.GadgetManager;
import mineplex.hub.modules.*; import mineplex.hub.modules.*;
@ -83,6 +84,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
private DonationManager _donationManager; private DonationManager _donationManager;
private DisguiseManager _disguiseManager; private DisguiseManager _disguiseManager;
private PartyManager _partyManager; private PartyManager _partyManager;
private ForcefieldManager _forcefieldManager;
private Portal _portal; private Portal _portal;
private StatsManager _statsManager; private StatsManager _statsManager;
private GadgetManager _gadgetManager; private GadgetManager _gadgetManager;
@ -128,6 +130,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
new WorldManager(this); new WorldManager(this);
new JumpManager(this); new JumpManager(this);
new NewsManager(this); new NewsManager(this);
_mountManager = new MountManager(this); _mountManager = new MountManager(this);
_gadgetManager = new GadgetManager(this, _mountManager, petManager); _gadgetManager = new GadgetManager(this, _mountManager, petManager);
@ -136,7 +139,10 @@ public class HubManager extends MiniClientPlugin<HubClient>
_preferences = preferences; _preferences = preferences;
_tutorialManager = new TutorialManager(this, donationManager, taskManager, _textCreator); _tutorialManager = new TutorialManager(this, donationManager, taskManager, _textCreator);
_visibilityManager = new VisibilityManager(this); _visibilityManager = new VisibilityManager(this);
_forcefieldManager = new ForcefieldManager(this);
AddCommand(new ForcefieldRadius(_forcefieldManager));
_statsManager = new StatsManager(plugin); _statsManager = new StatsManager(plugin);
((CraftWorld)Bukkit.getWorlds().get(0)).getHandle().pvpMode = true; ((CraftWorld)Bukkit.getWorlds().get(0)).getHandle().pvpMode = true;
@ -751,37 +757,6 @@ public class HubManager extends MiniClientPlugin<HubClient>
this._gadgetsEnabled = _enabled; this._gadgetsEnabled = _enabled;
} }
@EventHandler
public void ForcefieldUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
return;
for (Player player : UtilServer.getPlayers())
{
if (_preferences.Get(player).HubForcefield)
{
for (Player other : UtilServer.getPlayers())
{
if (player.equals(other))
continue;
if (UtilMath.offset(other, player) > 5)
continue;
if (GetClients().Get(other).GetRank().Has(Rank.ADMIN))
continue;
if (Recharge.Instance.use(other, "Forcefield Bump", 500, false, false))
{
UtilAction.velocity(other, UtilAlg.getTrajectory2d(player, other), 1.6, true, 0.8, 0, 10, true);
other.getWorld().playSound(other.getLocation(), Sound.CHICKEN_EGG_POP, 2f, 0.5f);
}
}
}
}
}
@Override @Override
protected void loadClientInformation(RetrieveClientInformationEvent event) protected void loadClientInformation(RetrieveClientInformationEvent event)
{ {

View File

@ -0,0 +1,21 @@
package mineplex.hub.commands;
import org.bukkit.entity.Player;
import mineplex.core.command.CommandBase;
import mineplex.core.common.Rank;
import mineplex.hub.modules.ForcefieldManager;
public class ForcefieldRadius extends CommandBase<ForcefieldManager>
{
public ForcefieldRadius(ForcefieldManager plugin)
{
super(plugin, Rank.OWNER, new String[] {"radius"});
}
@Override
public void Execute(Player caller, String[] args)
{
Plugin.ForcefieldRadius(caller, args);
}
}

View File

@ -0,0 +1,97 @@
package mineplex.hub.modules;
import java.util.HashMap;
import org.bukkit.Sound;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerQuitEvent;
import mineplex.core.MiniPlugin;
import mineplex.core.common.Rank;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.hub.HubManager;
public class ForcefieldManager extends MiniPlugin
{
public HubManager Manager;
private HashMap<Player, Integer> _radius = new HashMap<Player, Integer>();
public ForcefieldManager(HubManager manager)
{
super("Forcefield", manager.GetPlugin());
Manager = manager;
}
@EventHandler
public void ForcefieldUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.FASTER)
return;
for (Player player : UtilServer.getPlayers())
{
if (Manager.getPreferences().Get(player).HubForcefield)
{
for (Player other : UtilServer.getPlayers())
{
if (player.equals(other))
continue;
int range = 5;
if (_radius.containsKey(player))
range = _radius.get(player);
if (UtilMath.offset(other, player) > range)
continue;
if (Manager.GetClients().Get(other).GetRank().Has(Rank.ADMIN))
continue;
if (Recharge.Instance.use(other, "Forcefield Bump", 500, false, false))
{
Entity bottom = other;
while (bottom.getVehicle() != null)
bottom = bottom.getVehicle();
UtilAction.velocity(bottom, UtilAlg.getTrajectory2d(player, bottom), 1.6, true, 0.8, 0, 10, true);
other.getWorld().playSound(other.getLocation(), Sound.CHICKEN_EGG_POP, 2f, 0.5f);
}
}
}
}
}
public void ForcefieldRadius(Player caller, String[] args)
{
try
{
int range = Integer.parseInt(args[0]);
_radius.put(caller, range);
UtilPlayer.message(caller, F.main("Forcefield", "Radius set to " + F.elem(range + "") + "."));
}
catch (Exception e)
{
UtilPlayer.message(caller, F.main("Forcefield", "Invalid Input. Correct input is " + F.elem("/radius #") + "."));
}
}
@EventHandler
public void ForcefieldReset(PlayerQuitEvent event)
{
_radius.remove(event.getPlayer());
}
}

View File

@ -21,6 +21,7 @@ import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
@ -83,8 +84,15 @@ public class CompassAddon extends MiniPlugin
if (target != null) if (target != null)
{ {
if (!player.getInventory().contains(Material.COMPASS)) if (Manager.GetGame().CompassGiveItem)
player.getInventory().addItem(new ItemStack(Material.COMPASS)); if (!player.getInventory().contains(Material.COMPASS))
{
if (player.getOpenInventory() == null || player.getOpenInventory().getCursor() == null || player.getOpenInventory().getCursor().getType() != Material.COMPASS)
{
player.getInventory().addItem(new ItemStack(Material.COMPASS));
}
}
player.setCompassTarget(target.getLocation()); player.setCompassTarget(target.getLocation());
@ -146,9 +154,9 @@ public class CompassAddon extends MiniPlugin
} }
@EventHandler @EventHandler
public void PlayerInteract(PlayerInteractEvent event) public void SpectatorTeleport(PlayerInteractEvent event)
{ {
if (Manager.GetGame() == null || !Manager.GetGame().CompassEnabled) if (Manager.GetGame() == null)
return; return;
Player player = event.getPlayer(); Player player = event.getPlayer();
@ -159,6 +167,13 @@ public class CompassAddon extends MiniPlugin
if (Manager.GetGame().IsAlive(player)) if (Manager.GetGame().IsAlive(player))
return; return;
event.setCancelled(true);
if (!Recharge.Instance.use(player, "Spectate", 5000, true, false))
{
return;
}
GameTeam team = Manager.GetGame().GetTeam(player); GameTeam team = Manager.GetGame().GetTeam(player);
Player target = null; Player target = null;

View File

@ -112,6 +112,8 @@ public abstract class Game implements Listener
protected String[] _help; protected String[] _help;
//Gameplay Flags //Gameplay Flags
public long GameTimeout = 1200000;
public boolean Damage = true; public boolean Damage = true;
public boolean DamagePvP = true; public boolean DamagePvP = true;
public boolean DamagePvE = true; public boolean DamagePvE = true;
@ -181,6 +183,8 @@ public abstract class Game implements Listener
//Addons //Addons
public boolean CompassEnabled = false; public boolean CompassEnabled = false;
public boolean CompassGiveItem = true;
public boolean SoupEnabled = true; public boolean SoupEnabled = true;
public boolean TeamArmor = false; public boolean TeamArmor = false;
public boolean TeamArmorHotbar = false; public boolean TeamArmorHotbar = false;
@ -276,7 +280,7 @@ public abstract class Game implements Listener
return Scoreboard; return Scoreboard;
} }
public Objective GetObjectiveSide() private Objective GetObjectiveSide()
{ {
return Scoreboard.GetObjectiveSide(); return Scoreboard.GetObjectiveSide();
} }

View File

@ -81,9 +81,11 @@ public abstract class SoloGame extends Game
Scoreboard.Reset(); Scoreboard.Reset();
Scoreboard.WriteBlank();
GameTeam team = GetTeamList().get(0); GameTeam team = GetTeamList().get(0);
if (team.GetPlayers(false).size() < 16) if (team.GetPlayers(false).size() < 15)
{ {
for (Player player : team.GetPlayers(false)) for (Player player : team.GetPlayers(false))
{ {
@ -106,8 +108,6 @@ public abstract class SoloGame extends Game
} }
else else
{ {
Scoreboard.WriteBlank();
Scoreboard.Write(C.cGreen + "Players Alive"); Scoreboard.Write(C.cGreen + "Players Alive");
Scoreboard.Write("" + team.GetPlayers(true).size()); Scoreboard.Write("" + team.GetPlayers(true).size());

View File

@ -225,8 +225,10 @@ public abstract class TeamGame extends Game
for (GameTeam team : this.GetTeamList()) for (GameTeam team : this.GetTeamList())
{ {
//Display Individual Players //Display Individual Players
if (this.GetPlayers(true).size() < 16) if (this.GetPlayers(true).size() < 13)
{ {
Scoreboard.WriteBlank();
for (Player player : team.GetPlayers(true)) for (Player player : team.GetPlayers(true))
{ {
Scoreboard.Write(team.GetColor() + player.getName()); Scoreboard.Write(team.GetColor() + player.getName());
@ -239,7 +241,7 @@ public abstract class TeamGame extends Game
Scoreboard.WriteBlank(); Scoreboard.WriteBlank();
Scoreboard.Write(team.GetColor() + team.GetName()); Scoreboard.Write(team.GetColor() + team.GetName());
Scoreboard.Write("" + team.GetPlayers(true).size()); Scoreboard.Write(team.GetPlayers(true).size() + "" + team.GetColor() + " Alive");
} }
} }

View File

@ -1,13 +1,11 @@
package nautilus.game.arcade.game.games; package nautilus.game.arcade.game.games;
import nautilus.game.arcade.game.PlayerScore;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
public class GameScore implements PlayerScore public class GameScore
{ {
public org.bukkit.entity.Player Player; public org.bukkit.entity.Player Player;
public double Score; public double Score;
public GameScore(Player player, double i) public GameScore(Player player, double i)
{ {

View File

@ -130,6 +130,8 @@ public class Bridge extends TeamGame implements OreObsfucation
_ore = new OreHider(); _ore = new OreHider();
// Flags // Flags
GameTimeout = 96000000;
DamageSelf = true; DamageSelf = true;
ItemDrop = true; ItemDrop = true;
@ -992,27 +994,6 @@ public class Bridge extends TeamGame implements OreObsfucation
} }
} }
@EventHandler
public void BridgeTimer(UpdateEvent event)
{
if (GetState() != GameState.Live)
return;
if (event.getType() != UpdateType.TICK)
return;
long time = _bridgeTime
- (System.currentTimeMillis() - this.GetStateTime());
if (time > 0)
GetObjectiveSide().setDisplayName(
ChatColor.WHITE + "§lBridges in " + C.cGreen + "§l"
+ UtilTime.MakeStr(time));
else
GetObjectiveSide().setDisplayName(
ChatColor.WHITE + "§lBridges are down!");
}
@EventHandler(priority = EventPriority.LOW) @EventHandler(priority = EventPriority.LOW)
public void ChestProtect(EntityExplodeEvent event) public void ChestProtect(EntityExplodeEvent event)
{ {
@ -1105,8 +1086,26 @@ public class Bridge extends TeamGame implements OreObsfucation
//Display Players Alive //Display Players Alive
if (!_tournament) if (!_tournament)
{ {
super.ScoreboardUpdate(event); for (GameTeam team : this.GetTeamList())
return; {
//Display Individual Players
if (this.GetPlayers(true).size() < 10)
{
Scoreboard.WriteBlank();
for (Player player : team.GetPlayers(true))
{
Scoreboard.Write(team.GetColor() + player.getName());
}
}
//Display Players Alive
else
{
Scoreboard.WriteBlank();
Scoreboard.WriteOrdered("Score", team.GetColor() + "Players", team.GetPlayers(true).size(), true);
}
}
} }
//Display Kills + Players //Display Kills + Players
else else
@ -1119,12 +1118,27 @@ public class Bridge extends TeamGame implements OreObsfucation
Scoreboard.WriteBlank(); Scoreboard.WriteBlank();
Scoreboard.Write(team.GetColor() + C.Bold + team.GetName());
Scoreboard.Write(team.GetColor() + " " + team.GetPlayers(true).size() + " Players"); Scoreboard.Write(team.GetColor() + " " + team.GetPlayers(true).size() + " Players");
Scoreboard.Write(team.GetColor() + " " + kills + " Kills"); Scoreboard.Write(team.GetColor() + " " + kills + " Kills");
} }
} }
Scoreboard.WriteBlank();
long time = _bridgeTime
- (System.currentTimeMillis() - this.GetStateTime());
if (time > 0)
{
Scoreboard.Write(C.cYellow + C.Bold + "Bridges Spawn");
Scoreboard.Write(UtilTime.MakeStr(time, 0));
}
else
{
Scoreboard.Write(C.cYellow + C.Bold + "Bridges Down!");
}
Scoreboard.Draw(); Scoreboard.Draw();
} }

View File

@ -430,6 +430,26 @@ public class CastleSiege extends TeamGame
Scoreboard.Write(_kingHealth + " Health"); Scoreboard.Write(_kingHealth + " Health");
} }
long timeLeft = 24000 - WorldTimeSet;
timeLeft = timeLeft / 20 * 1000;
if (timeLeft > 0)
{
Scoreboard.WriteBlank();
Scoreboard.Write(C.cYellow + C.Bold + "Sun Rise");
Scoreboard.Write(UtilTime.MakeStr(timeLeft, 0));
}
else
{
Scoreboard.WriteBlank();
Scoreboard.Write(C.cYellow + C.Bold + "Sun Rise");
Scoreboard.Write("Undead Burning!");
for (Player player : GetTeam(ChatColor.RED).GetPlayers(true))
Manager.GetCondition().Factory().Ignite("Sun Damage", player, player, 5, false, false);
}
Scoreboard.Draw(); Scoreboard.Draw();
} }
@ -777,24 +797,6 @@ public class CastleSiege extends TeamGame
return; return;
WorldTimeSet = (WorldTimeSet+1); WorldTimeSet = (WorldTimeSet+1);
long timeLeft = 24000 - WorldTimeSet;
timeLeft = timeLeft / 20 * 1000;
if (timeLeft > 0)
GetObjectiveSide().setDisplayName(
ChatColor.WHITE + "§lSun Rise: " + C.cGreen + "§l"
+ UtilTime.MakeStr(timeLeft));
else
{
GetObjectiveSide().setDisplayName(
ChatColor.WHITE + "§lSun has risen!");
for (Player player : GetTeam(ChatColor.RED).GetPlayers(true))
Manager.GetCondition().Factory().Ignite("Sun Damage", player, player, 5, false, false);
}
} }
@EventHandler @EventHandler

View File

@ -47,41 +47,41 @@ public class TeamDeathmatch extends TeamGame
{ {
private ArrayList<CapturePointTDM> _points = new ArrayList<CapturePointTDM>(); private ArrayList<CapturePointTDM> _points = new ArrayList<CapturePointTDM>();
private ArrayList<Resupply> _resupply = new ArrayList<Resupply>(); private ArrayList<Resupply> _resupply = new ArrayList<Resupply>();
private HashMap<Player, Integer> _kills = new HashMap<Player, Integer>(); private HashMap<Player, Integer> _kills = new HashMap<Player, Integer>();
private Objective _healthObj; private Objective _healthObj;
private boolean _beaconEnabled = false; private boolean _beaconEnabled = false;
private long _beaconTime = 180000; private long _beaconTime = 180000;
//Scores //Scores
private int _victoryScore = 120; private int _victoryScore = 120;
private int _redScore = 0; private int _redScore = 0;
private int _blueScore = 0; private int _blueScore = 0;
public TeamDeathmatch(ArcadeManager manager, GameType type, Kit[] kits) public TeamDeathmatch(ArcadeManager manager, GameType type, Kit[] kits)
{ {
super(manager, type, kits, super(manager, type, kits,
new String[] new String[]
{ {
"Each player has " + C.cRed + C.Bold + "ONE LIFE", "Each player has " + C.cRed + C.Bold + "ONE LIFE",
"Kill the other team to win!", "Kill the other team to win!",
}); });
this.DeathOut = true; this.DeathOut = true;
this.HungerSet = 20; this.HungerSet = 20;
this.WorldTimeSet = 2000; this.WorldTimeSet = 2000;
this.CompassEnabled = true; this.CompassEnabled = true;
this.Manager.GetDamage().UseSimpleWeaponDamage = false; this.Manager.GetDamage().UseSimpleWeaponDamage = false;
//_healthObj = GetScoreboard().registerNewObjective("HP", "dummy"); //_healthObj = GetScoreboard().registerNewObjective("HP", "dummy");
//_healthObj.setDisplaySlot(DisplaySlot.BELOW_NAME); //_healthObj.setDisplaySlot(DisplaySlot.BELOW_NAME);
} }
@Override @Override
public void ParseData() public void ParseData()
{ {
@ -89,7 +89,7 @@ public class TeamDeathmatch extends TeamGame
{ {
_points.add(new CapturePointTDM(this, pointName, WorldData.GetAllCustomLocs().get(pointName).get(0))); _points.add(new CapturePointTDM(this, pointName, WorldData.GetAllCustomLocs().get(pointName).get(0)));
} }
for (Location loc : WorldData.GetDataLocs("YELLOW")) for (Location loc : WorldData.GetDataLocs("YELLOW"))
{ {
_resupply.add(new Resupply(this, loc)); _resupply.add(new Resupply(this, loc));
@ -101,14 +101,14 @@ public class TeamDeathmatch extends TeamGame
{ {
if (!(event.GetEvent().getEntity() instanceof Player)) if (!(event.GetEvent().getEntity() instanceof Player))
return; return;
Player killed = (Player)event.GetEvent().getEntity(); Player killed = (Player)event.GetEvent().getEntity();
SetPlayerState(killed, PlayerState.OUT); SetPlayerState(killed, PlayerState.OUT);
GameTeam killedTeam = GetTeam(killed); GameTeam killedTeam = GetTeam(killed);
if (killedTeam == null) if (killedTeam == null)
return; return;
if (event.GetLog().GetKiller() != null) if (event.GetLog().GetKiller() != null)
{ {
Player killer = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName()); Player killer = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName());
@ -118,11 +118,11 @@ public class TeamDeathmatch extends TeamGame
GameTeam killerTeam = GetTeam(killer); GameTeam killerTeam = GetTeam(killer);
if (killerTeam == null) if (killerTeam == null)
return; return;
int kills = 1; int kills = 1;
if (killedTeam.equals(killerTeam)) if (killedTeam.equals(killerTeam))
kills = -1; kills = -1;
if (_kills.containsKey(killer)) if (_kills.containsKey(killer))
kills += _kills.get(killer); kills += _kills.get(killer);
@ -138,14 +138,14 @@ public class TeamDeathmatch extends TeamGame
{ {
if (event.GetState() != GameState.Live) if (event.GetState() != GameState.Live)
return; return;
for (Player player : GetPlayers(true)) for (Player player : GetPlayers(true))
{ {
player.setMaxHealth(30); player.setMaxHealth(30);
player.setHealth(player.getMaxHealth()); player.setHealth(player.getMaxHealth());
} }
} }
@Override @Override
public double GetKillsGems(Player killer, Player killed, boolean assist) public double GetKillsGems(Player killer, Player killed, boolean assist)
{ {
@ -156,7 +156,7 @@ public class TeamDeathmatch extends TeamGame
{ {
return "Team Deathmatch"; return "Team Deathmatch";
} }
@Override @Override
public void ValidateKit(Player player, GameTeam team) public void ValidateKit(Player player, GameTeam team)
{ {
@ -167,13 +167,13 @@ public class TeamDeathmatch extends TeamGame
player.closeInventory(); player.closeInventory();
} }
} }
@Override @Override
public DeathMessageType GetDeathMessageType() public DeathMessageType GetDeathMessageType()
{ {
return DeathMessageType.Detailed; return DeathMessageType.Detailed;
} }
@EventHandler @EventHandler
public void DisplayHealth(UpdateEvent event) public void DisplayHealth(UpdateEvent event)
{ {
@ -181,7 +181,7 @@ public class TeamDeathmatch extends TeamGame
for (Player player : GetPlayers(true)) for (Player player : GetPlayers(true))
_healthObj.getScore(player.getName()).setScore((int)player.getHealth()); _healthObj.getScore(player.getName()).setScore((int)player.getHealth());
} }
@EventHandler @EventHandler
public void WaterArrowCancel(EntityShootBowEvent event) public void WaterArrowCancel(EntityShootBowEvent event)
{ {
@ -191,7 +191,7 @@ public class TeamDeathmatch extends TeamGame
event.setCancelled(true); event.setCancelled(true);
} }
} }
@EventHandler @EventHandler
public void Updates(UpdateEvent event) public void Updates(UpdateEvent event)
{ {
@ -206,106 +206,91 @@ public class TeamDeathmatch extends TeamGame
for (Resupply cur : _resupply) for (Resupply cur : _resupply)
cur.Update(); cur.Update();
} }
@EventHandler @EventHandler
public void BeaconUpdate(UpdateEvent event) public void BeaconUpdate(UpdateEvent event)
{ {
if (!IsLive()) if (!IsLive())
return; return;
if (event.getType() != UpdateType.TICK) if (event.getType() != UpdateType.TICK)
return; return;
if (_beaconEnabled) if (_beaconEnabled)
return; return;
if (UtilTime.elapsed(GetStateTime(), _beaconTime)) if (UtilTime.elapsed(GetStateTime(), _beaconTime))
{ {
_beaconEnabled = true; _beaconEnabled = true;
Announce(C.cWhite + C.Bold + "Capture Point is active!"); Announce(C.cWhite + C.Bold + "Capture Point is active!");
_points.get(UtilMath.r(_points.size())).Enable(); _points.get(UtilMath.r(_points.size())).Enable();
GetObjectiveSide().setDisplayName(
ChatColor.WHITE + "§lFirst to " + C.cGreen + "§l" + _victoryScore);
for (Player player : UtilServer.getPlayers()) for (Player player : UtilServer.getPlayers())
player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1f, 1f); player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1f, 1f);
} }
else
{
long timeLeft = _beaconTime - (System.currentTimeMillis() - GetStateTime());
GetObjectiveSide().setDisplayName(
ChatColor.WHITE + "§lBeacon: " + C.cGreen + "§l"
+ UtilTime.MakeStr(timeLeft));
}
} }
@Override @Override
@EventHandler @EventHandler
public void ScoreboardUpdate(UpdateEvent event) public void ScoreboardUpdate(UpdateEvent event)
{ {
if (event != null && event.getType() != UpdateType.FAST) if (event != null && event.getType() != UpdateType.FAST)
return; return;
ScoreboardWrite(); ScoreboardWrite();
} }
public void ScoreboardWrite() public void ScoreboardWrite()
{ {
Scoreboard.Reset(); Scoreboard.Reset();
for (GameTeam team : this.GetTeamList()) for (GameTeam team : this.GetTeamList())
{ {
//Display Individual Players //Display Individual Players
if (this.GetPlayers(true).size() < 11) if (this.GetPlayers(true).size() < 10)
{ {
for (Player player : team.GetPlayers(true)) for (Player player : team.GetPlayers(true))
{ {
Scoreboard.Write(team.GetColor() + player.getName()); Scoreboard.Write(team.GetColor() + player.getName());
} }
} }
//Display Players Alive //Display Players Alive
else else
{ {
Scoreboard.WriteBlank(); Scoreboard.WriteBlank();
Scoreboard.Write(team.GetColor() + team.GetName()); Scoreboard.Write(team.GetColor() + team.GetName() + " Alive");
Scoreboard.Write("" + team.GetPlayers(true).size()); Scoreboard.Write("" + team.GetPlayers(true).size());
} }
} }
if (_beaconEnabled) if (_beaconEnabled)
{ {
for (GameTeam team : this.GetTeamList()) Scoreboard.WriteBlank();
{ Scoreboard.Write(C.cYellow + C.Bold + " Beacon");
Scoreboard.WriteBlank(); Scoreboard.Write(C.cRed + _redScore + C.cWhite + " " + C.cAqua + _blueScore);
Scoreboard.Write(team.GetColor() + team.GetName());
if (team.GetColor() == ChatColor.RED)
Scoreboard.Write("" + _redScore);
else
Scoreboard.Write("" + _blueScore + " ");
}
} }
else else
{ {
long timeLeft = _beaconTime - (System.currentTimeMillis() - GetStateTime());
Scoreboard.WriteBlank();
Scoreboard.Write(C.cYellow + C.Bold + " Beacon Spawn");
Scoreboard.Write(UtilTime.MakeStr(timeLeft, 0));
} }
Scoreboard.Draw(); Scoreboard.Draw();
} }
public void AddScore(GameTeam team, int score) public void AddScore(GameTeam team, int score)
{ {
if (team == null) if (team == null)
return; return;
if (team.GetColor() == ChatColor.RED) if (team.GetColor() == ChatColor.RED)
{ {
_redScore = Math.min(_victoryScore, _redScore + score); _redScore = Math.min(_victoryScore, _redScore + score);
@ -317,14 +302,14 @@ public class TeamDeathmatch extends TeamGame
EndCheckScore(); EndCheckScore();
} }
public void EndCheckScore() public void EndCheckScore()
{ {
if (!IsLive()) if (!IsLive())
return; return;
GameTeam winner = null; GameTeam winner = null;
if (_redScore >= _victoryScore) if (_redScore >= _victoryScore)
winner = GetTeam(ChatColor.RED); winner = GetTeam(ChatColor.RED);
else if (_blueScore >= _victoryScore) else if (_blueScore >= _victoryScore)
@ -332,7 +317,7 @@ public class TeamDeathmatch extends TeamGame
if (winner == null) if (winner == null)
return; return;
ScoreboardWrite(); ScoreboardWrite();
//Announce //Announce
@ -350,12 +335,12 @@ public class TeamDeathmatch extends TeamGame
if (player.isOnline()) if (player.isOnline())
AddGems(player, 10, "Participation", false); AddGems(player, 10, "Participation", false);
} }
if (EloRanking) if (EloRanking)
{ {
EloTeam teamWinner = new EloTeam(); EloTeam teamWinner = new EloTeam();
EloTeam teamLoser = new EloTeam(); EloTeam teamLoser = new EloTeam();
for (GameTeam team : GetTeamList()) for (GameTeam team : GetTeamList())
{ {
if (WinnerTeam != null && team.equals(WinnerTeam)) if (WinnerTeam != null && team.equals(WinnerTeam))
@ -365,7 +350,7 @@ public class TeamDeathmatch extends TeamGame
EloPlayer eloPlayer = new EloPlayer(); EloPlayer eloPlayer = new EloPlayer();
eloPlayer.UniqueId = player.getUniqueId().toString(); eloPlayer.UniqueId = player.getUniqueId().toString();
eloPlayer.Rating = Manager.getEloManager().getElo(player.getUniqueId(), GetName()); eloPlayer.Rating = Manager.getEloManager().getElo(player.getUniqueId(), GetName());
teamWinner.addPlayer(eloPlayer); teamWinner.addPlayer(eloPlayer);
} }
} }
@ -376,23 +361,23 @@ public class TeamDeathmatch extends TeamGame
EloPlayer eloPlayer = new EloPlayer(); EloPlayer eloPlayer = new EloPlayer();
eloPlayer.UniqueId = player.getUniqueId().toString(); eloPlayer.UniqueId = player.getUniqueId().toString();
eloPlayer.Rating = Manager.getEloManager().getElo(player.getUniqueId(), GetName()); eloPlayer.Rating = Manager.getEloManager().getElo(player.getUniqueId(), GetName());
teamLoser.addPlayer(eloPlayer); teamLoser.addPlayer(eloPlayer);
} }
} }
} }
for (EloPlayer eloPlayer : Manager.getEloManager().getNewRatings(teamWinner, teamLoser, GameResult.Win).getPlayers()) for (EloPlayer eloPlayer : Manager.getEloManager().getNewRatings(teamWinner, teamLoser, GameResult.Win).getPlayers())
{ {
Manager.getEloManager().saveElo(eloPlayer.UniqueId, GetName(), eloPlayer.Rating); Manager.getEloManager().saveElo(eloPlayer.UniqueId, GetName(), eloPlayer.Rating);
} }
for (EloPlayer eloPlayer : Manager.getEloManager().getNewRatings(teamLoser, teamWinner, GameResult.Loss).getPlayers()) for (EloPlayer eloPlayer : Manager.getEloManager().getNewRatings(teamLoser, teamWinner, GameResult.Loss).getPlayers())
{ {
Manager.getEloManager().saveElo(eloPlayer.UniqueId, GetName(), eloPlayer.Rating); Manager.getEloManager().saveElo(eloPlayer.UniqueId, GetName(), eloPlayer.Rating);
} }
} }
//End //End
SetState(GameState.End); SetState(GameState.End);
} }

View File

@ -15,6 +15,7 @@ import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
@ -297,8 +298,18 @@ public class DeathTag extends SoloGame
if (_runners == null || _chasers == null) if (_runners == null || _chasers == null)
return; return;
GetObjectiveSide().getScore(_runners.GetColor() + _runners.GetName()).setScore(_runners.GetPlayers(true).size()); //Wipe Last
GetObjectiveSide().getScore(_chasers.GetColor() + _chasers.GetName()).setScore(_chasers.GetPlayers(true).size()); Scoreboard.Reset();
Scoreboard.WriteBlank();
Scoreboard.Write(_runners.GetPlayers(true).size() + " " +_runners.GetColor() + " Runners");
Scoreboard.WriteBlank();
Scoreboard.Write(_chasers.GetPlayers(true).size() + " " +_chasers.GetColor() + " Chasers");
Scoreboard.Draw();
} }
@Override @Override

View File

@ -296,8 +296,10 @@ public class DragonEscape extends SoloGame
//Wipe Last //Wipe Last
Scoreboard.Reset(); Scoreboard.Reset();
Scoreboard.WriteBlank();
//Write New //Write New
for (int i=0 ; i<_ranks.size() && i<15 ; i++) for (int i=0 ; i<_ranks.size() && i<14 ; i++)
{ {
DragonScore score = _ranks.get(i); DragonScore score = _ranks.get(i);

View File

@ -375,7 +375,7 @@ public class DragonEscapeTeams extends TeamGame
Scoreboard.WriteBlank(); Scoreboard.WriteBlank();
Scoreboard.Write(team.GetColor() + team.GetName()); Scoreboard.Write(team.GetColor() + team.GetName());
Scoreboard.Write(team.GetColor() + "" + score); Scoreboard.Write(score + "" + team.GetColor() + " Score");
} }
Scoreboard.Draw(); Scoreboard.Draw();

View File

@ -252,8 +252,6 @@ public class DragonsTeams extends TeamGame
//Wipe Last //Wipe Last
Scoreboard.Reset(); Scoreboard.Reset();
int i=1;
String space = " ";
for (GameTeam team : _teamScore.keySet()) for (GameTeam team : _teamScore.keySet())
{ {
//Time //Time

View File

@ -953,14 +953,8 @@ public class HideSeek extends TeamGame
{ {
long timeLeft = _hideTime - (System.currentTimeMillis() - GetStateTime()); long timeLeft = _hideTime - (System.currentTimeMillis() - GetStateTime());
if (timeLeft > 0) if (timeLeft <= 0)
{ {
GetObjectiveSide().setDisplayName(
ChatColor.WHITE + "§lHide Time: " + C.cGreen + "§l"
+ UtilTime.MakeStr(timeLeft));
}
else
{
_started = true; _started = true;
//Hider Items //Hider Items
@ -978,18 +972,10 @@ public class HideSeek extends TeamGame
{ {
long timeLeft = _gameTime - (System.currentTimeMillis() - GetStateTime() - _hideTime); long timeLeft = _gameTime - (System.currentTimeMillis() - GetStateTime() - _hideTime);
if (timeLeft > 0) if (timeLeft <= 0)
{ {
GetObjectiveSide().setDisplayName( WriteScoreboard();
ChatColor.WHITE + "§lHunt Time: " + C.cGreen + "§l"
+ UtilTime.MakeStr(timeLeft));
}
else
{
GetObjectiveSide().setDisplayName(
ChatColor.WHITE + "§lHunt Time: " + C.cGreen + "§l"
+ UtilTime.MakeStr(0));
SetState(GameState.End); SetState(GameState.End);
AnnounceEnd(_hiders); AnnounceEnd(_hiders);
@ -1002,6 +988,48 @@ public class HideSeek extends TeamGame
} }
} }
} }
@Override
@EventHandler
public void ScoreboardUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
return;
WriteScoreboard();
}
private void WriteScoreboard()
{
//Wipe Last
Scoreboard.Reset();
for (GameTeam team : this.GetTeamList())
{
Scoreboard.WriteBlank();
Scoreboard.Write(team.GetPlayers(true).size() + " " + team.GetColor() + team.GetName());
}
if (!_started)
{
long timeLeft = _hideTime - (System.currentTimeMillis() - GetStateTime());
Scoreboard.WriteBlank();
Scoreboard.Write(C.cYellow + C.Bold + "Hide Time");
Scoreboard.Write(UtilTime.MakeStr(Math.max(0, timeLeft), 0));
}
else
{
long timeLeft = _gameTime - (System.currentTimeMillis() - GetStateTime() - _hideTime);
Scoreboard.WriteBlank();
Scoreboard.Write(C.cYellow + C.Bold + "Seek Time");
Scoreboard.Write(UtilTime.MakeStr(Math.max(0, timeLeft), 0));
}
Scoreboard.Draw();
}
@Override @Override
public GameTeam ChooseTeam(Player player) public GameTeam ChooseTeam(Player player)

View File

@ -477,6 +477,8 @@ public class MilkCow extends SoloGame
//Wipe Last //Wipe Last
Scoreboard.Reset(); Scoreboard.Reset();
Scoreboard.WriteBlank();
for (Player player : GetPlayers(true)) for (Player player : GetPlayers(true))
{ {

View File

@ -185,9 +185,11 @@ public class MineWare extends SoloGame
Announce(C.cYellow + C.Bold + _order.GetOrder().toUpperCase()); Announce(C.cYellow + C.Bold + _order.GetOrder().toUpperCase());
/* XXX
GetObjectiveSide().setDisplayName( GetObjectiveSide().setDisplayName(
ChatColor.WHITE + "§lMineWare " + C.cGreen + "§l" ChatColor.WHITE + "§lMineWare " + C.cGreen + "§l"
+ "Round " + _orderCount); + "Round " + _orderCount);
*/
} }
//Update Order //Update Order
else else

View File

@ -86,8 +86,6 @@ public class Quiver extends SoloGame
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte)1, 1, F.item("Super Arrow"))); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte)1, 1, F.item("Super Arrow")));
player.playSound(player.getLocation(), Sound.PISTON_EXTEND, 3f, 2f); player.playSound(player.getLocation(), Sound.PISTON_EXTEND, 3f, 2f);
} }
GetObjectiveSide().setDisplayName(C.cWhite + C.Bold + "First to " + C.cGold + C.Bold + "20 Kills");
} }
@EventHandler @EventHandler
@ -260,12 +258,12 @@ public class Quiver extends SoloGame
//Wipe Last //Wipe Last
Scoreboard.Reset(); Scoreboard.Reset();
Scoreboard.WriteBlank();
//Write New //Write New
for (int i=0 ; i<_ranks.size() && i<15 ; i++) for (QuiverScore score : _ranks)
{ {
QuiverScore score = _ranks.get(i);
Scoreboard.WriteOrdered("Score", C.cGreen + score.Player.getName(), score.Kills, true); Scoreboard.WriteOrdered("Score", C.cGreen + score.Player.getName(), score.Kills, true);
} }

View File

@ -81,8 +81,6 @@ public class QuiverTeams extends TeamGame
player.playSound(player.getLocation(), Sound.PISTON_EXTEND, 3f, 2f); player.playSound(player.getLocation(), Sound.PISTON_EXTEND, 3f, 2f);
} }
GetObjectiveSide().setDisplayName(C.cWhite + C.Bold + "First to " + C.cGold + C.Bold + _reqKills +" Kills");
for (GameTeam team : GetTeamList()) for (GameTeam team : GetTeamList())
{ {
_teamKills.put(team, 0); _teamKills.put(team, 0);
@ -194,7 +192,7 @@ public class QuiverTeams extends TeamGame
Scoreboard.WriteBlank(); Scoreboard.WriteBlank();
Scoreboard.Write(team.GetColor() + team.GetName()); Scoreboard.Write(team.GetColor() + team.GetName());
Scoreboard.Write(team.GetColor() + "" + kills + " Kills"); Scoreboard.Write(kills + "" + team.GetColor() + " Kills");
} }
Scoreboard.Draw(); Scoreboard.Draw();

View File

@ -101,14 +101,14 @@ public class SheepGame extends TeamGame
"Return Sheep to your Team Pen!", "Return Sheep to your Team Pen!",
"Most sheep at 5 minutes wins!" "Most sheep at 5 minutes wins!"
}); });
this.DeathOut = false; this.DeathOut = false;
this.DeathSpectateSecs = 8; this.DeathSpectateSecs = 8;
this.HungerSet = 20; this.HungerSet = 20;
this.WorldTimeSet = 2000; this.WorldTimeSet = 2000;
this.TeamArmor = true; this.TeamArmor = true;
this.TeamArmorHotbar = true; this.TeamArmorHotbar = true;
} }
@ -200,7 +200,7 @@ public class SheepGame extends TeamGame
return; return;
Player player = event.getPlayer(); Player player = event.getPlayer();
if (!Recharge.Instance.usable(player, "Sheep Stack")) if (!Recharge.Instance.usable(player, "Sheep Stack"))
return; return;
@ -212,7 +212,7 @@ public class SheepGame extends TeamGame
if (!IsAlive(event.getPlayer())) if (!IsAlive(event.getPlayer()))
return; return;
if (player.getPassenger() != null && player.getPassenger() instanceof Player) if (player.getPassenger() != null && player.getPassenger() instanceof Player)
{ {
DropSheep(player); DropSheep(player);
@ -246,11 +246,11 @@ public class SheepGame extends TeamGame
data.SetHolder(event.getPlayer()); data.SetHolder(event.getPlayer());
} }
} }
//Put Wool in Inventory //Put Wool in Inventory
player.getInventory().setItem(4 + count, ItemStackFactory.Instance.CreateStack(35, ((Sheep)event.getRightClicked()).getColor().getWoolData())); player.getInventory().setItem(4 + count, ItemStackFactory.Instance.CreateStack(35, ((Sheep)event.getRightClicked()).getColor().getWoolData()));
UtilInv.Update(player); UtilInv.Update(player);
//Effect //Effect
event.getRightClicked().getWorld().playEffect(event.getRightClicked().getLocation(), Effect.STEP_SOUND, 35); event.getRightClicked().getWorld().playEffect(event.getRightClicked().getLocation(), Effect.STEP_SOUND, 35);
@ -260,7 +260,7 @@ public class SheepGame extends TeamGame
//Audio //Audio
player.playSound(player.getLocation(), Sound.SHEEP_IDLE, 2f, 3f); player.playSound(player.getLocation(), Sound.SHEEP_IDLE, 2f, 3f);
} }
@EventHandler @EventHandler
public void StackPlayer(PlayerInteractEntityEvent event) public void StackPlayer(PlayerInteractEntityEvent event)
{ {
@ -275,16 +275,16 @@ public class SheepGame extends TeamGame
Player player = event.getPlayer(); Player player = event.getPlayer();
Player other = (Player)event.getRightClicked(); Player other = (Player)event.getRightClicked();
if (!(GetKit(player) instanceof KitBrute)) if (!(GetKit(player) instanceof KitBrute))
return; return;
if (!GetTeam(player).HasPlayer(other)) if (!GetTeam(player).HasPlayer(other))
return; return;
if (player.getPassenger() != null) if (player.getPassenger() != null)
DropSheep(player); DropSheep(player);
if (!Recharge.Instance.usable(player, "Sheep Stack")) if (!Recharge.Instance.usable(player, "Sheep Stack"))
return; return;
@ -306,12 +306,12 @@ public class SheepGame extends TeamGame
//Audio //Audio
player.playSound(player.getLocation(), Sound.VILLAGER_YES, 2f, 3f); player.playSound(player.getLocation(), Sound.VILLAGER_YES, 2f, 3f);
other.playSound(player.getLocation(), Sound.VILLAGER_NO, 2f, 3f); other.playSound(player.getLocation(), Sound.VILLAGER_NO, 2f, 3f);
//Inform //Inform
UtilPlayer.message(other, F.main("Skill", F.elem(GetTeam(player).GetColor() + player.getName()) + " picked you up.")); UtilPlayer.message(other, F.main("Skill", F.elem(GetTeam(player).GetColor() + player.getName()) + " picked you up."));
UtilPlayer.message(player, F.main("Skill", "You picked up " + F.elem(GetTeam(player).GetColor() + player.getName()) + ".")); UtilPlayer.message(player, F.main("Skill", "You picked up " + F.elem(GetTeam(player).GetColor() + player.getName()) + "."));
} }
@EventHandler @EventHandler
public void DeathDrop(PlayerDeathEvent event) public void DeathDrop(PlayerDeathEvent event)
{ {
@ -389,7 +389,7 @@ public class SheepGame extends TeamGame
} }
player.setExp(0.33f * (float)count); player.setExp(0.33f * (float)count);
//Inventory Wool Clean //Inventory Wool Clean
if (count <= 0 && UtilGear.isMat(player.getInventory().getItem(4), Material.WOOL)) if (count <= 0 && UtilGear.isMat(player.getInventory().getItem(4), Material.WOOL))
player.getInventory().setItem(4, null); player.getInventory().setItem(4, null);
@ -456,27 +456,6 @@ public class SheepGame extends TeamGame
Manager.GetCondition().Factory().Regen("Respawn", event.GetPlayer(), event.GetPlayer(), 5, 3, false, false, true); Manager.GetCondition().Factory().Regen("Respawn", event.GetPlayer(), event.GetPlayer(), 5, 3, false, false, true);
} }
@EventHandler
public void ScoreboardTimer(UpdateEvent event)
{
if (GetState() != GameState.Live)
return;
if (event.getType() != UpdateType.TICK)
return;
long time = _gameTime
- (System.currentTimeMillis() - this.GetStateTime());
if (time > 0)
GetObjectiveSide().setDisplayName(
ChatColor.WHITE + "§lTime Left " + C.cGreen + "§l"
+ UtilTime.MakeStr(time));
else
GetObjectiveSide().setDisplayName(
ChatColor.WHITE + "§lTime Up!");
}
@Override @Override
@EventHandler @EventHandler
public void ScoreboardUpdate(UpdateEvent event) public void ScoreboardUpdate(UpdateEvent event)
@ -489,6 +468,7 @@ public class SheepGame extends TeamGame
//Wipe Last //Wipe Last
Scoreboard.Reset(); Scoreboard.Reset();
Scoreboard.WriteBlank();
//Write New //Write New
for (GameTeam team : _sheepPens.keySet()) for (GameTeam team : _sheepPens.keySet())
@ -512,9 +492,16 @@ public class SheepGame extends TeamGame
return; return;
Scoreboard.WriteBlank(); Scoreboard.WriteBlank();
Scoreboard.Write(C.Bold + "Next Sheep;"); Scoreboard.Write(C.cYellow + C.Bold + "Next Sheep");
Scoreboard.Write(C.cGreen + C.Bold + (int)UtilTime.convert(_sheepDelay - (System.currentTimeMillis() - _sheepTimer), 0, TimeUnit.FIT) + " Seconds"); Scoreboard.Write(UtilTime.MakeStr(_sheepDelay - (System.currentTimeMillis() - _sheepTimer), 0));
long time = _gameTime
- (System.currentTimeMillis() - this.GetStateTime());
Scoreboard.WriteBlank();
Scoreboard.Write(C.cYellow + C.Bold + "Time Left");
Scoreboard.Write(UtilTime.MakeStr(Math.max(0, time), 0));
Scoreboard.Draw(); Scoreboard.Draw();
} }
@ -629,7 +616,7 @@ public class SheepGame extends TeamGame
if (event.getMessage().contains("/giant")) if (event.getMessage().contains("/giant"))
{ {
Giant giant = event.getPlayer().getWorld().spawn(event.getPlayer().getLocation(), Giant.class); Giant giant = event.getPlayer().getWorld().spawn(event.getPlayer().getLocation(), Giant.class);
Entity top = giant; Entity top = giant;
for (int i=0 ; i < 10 ; i++) for (int i=0 ; i < 10 ; i++)
{ {
@ -637,11 +624,11 @@ public class SheepGame extends TeamGame
top.setPassenger(buffer); top.setPassenger(buffer);
top = buffer; top = buffer;
} }
top.setPassenger(event.getPlayer()); top.setPassenger(event.getPlayer());
} }
} }
@EventHandler @EventHandler
public void Invul(CustomDamageEvent event) public void Invul(CustomDamageEvent event)
{ {

View File

@ -155,7 +155,7 @@ public class SuperSmash extends SoloGame
//Wipe Last //Wipe Last
Scoreboard.Reset(); Scoreboard.Reset();
if (GetPlayers(true).size() > 15) if (GetPlayers(true).size() > 14)
{ {
Scoreboard.WriteBlank(); Scoreboard.WriteBlank();
Scoreboard.Write(C.cGreen + "Players Alive"); Scoreboard.Write(C.cGreen + "Players Alive");
@ -167,6 +167,8 @@ public class SuperSmash extends SoloGame
} }
else else
{ {
Scoreboard.WriteBlank();
//Write New //Write New
for (Player player : GetPlayers(true)) for (Player player : GetPlayers(true))
{ {

View File

@ -155,7 +155,7 @@ public class SuperSmashTeam extends TeamGame
//Wipe Last //Wipe Last
Scoreboard.Reset(); Scoreboard.Reset();
if (GetPlayers(true).size() > 15) if (GetPlayers(true).size() > 14)
{ {
for (GameTeam team : this.GetTeamList()) for (GameTeam team : this.GetTeamList())
{ {
@ -171,6 +171,8 @@ public class SuperSmashTeam extends TeamGame
} }
else else
{ {
Scoreboard.WriteBlank();
//Write New //Write New
for (Player player : GetPlayers(true)) for (Player player : GetPlayers(true))
{ {

View File

@ -24,7 +24,6 @@ import nautilus.game.arcade.kit.Kit;
public class SquidShooter extends SoloGame public class SquidShooter extends SoloGame
{ {
private ArrayList<QuiverScore> _ranks = new ArrayList<QuiverScore>(); private ArrayList<QuiverScore> _ranks = new ArrayList<QuiverScore>();
private ArrayList<String> _lastScoreboard = new ArrayList<String>();
public SquidShooter(ArcadeManager manager) public SquidShooter(ArcadeManager manager)
{ {
@ -52,17 +51,7 @@ public class SquidShooter extends SoloGame
this.SpawnDistanceRequirement = 16; this.SpawnDistanceRequirement = 16;
this.CompassEnabled = true; this.CompassEnabled = true;
this.KitRegisterState = GameState.Prepare; this.KitRegisterState = GameState.Prepare;
} }
@EventHandler(priority = EventPriority.HIGH)
public void GameStateChange(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Live)
return;
GetObjectiveSide().setDisplayName(C.cWhite + C.Bold + "First to " + C.cGold + C.Bold + "20 Kills");
}
@EventHandler @EventHandler
public void Death(CombatDeathEvent event) public void Death(CombatDeathEvent event)
{ {

View File

@ -78,6 +78,7 @@ import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType; import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.SoloGame; import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.survivalgames.kit.*; import nautilus.game.arcade.game.games.survivalgames.kit.*;
@ -161,6 +162,8 @@ public class SurvivalGames extends SoloGame
Manager.GetAntiStack().SetEnabled(false); Manager.GetAntiStack().SetEnabled(false);
this.GameTimeout = 9600000;
this.WorldTimeSet = 0; this.WorldTimeSet = 0;
this.WorldBoundaryKill = false; this.WorldBoundaryKill = false;
@ -1207,17 +1210,8 @@ public class SurvivalGames extends SoloGame
long timeLeft = 60000 - (System.currentTimeMillis() - _deathmatchTime); long timeLeft = 60000 - (System.currentTimeMillis() - _deathmatchTime);
if (timeLeft > 0) if (timeLeft <= 0)
{ {
GetObjectiveSide().setDisplayName(
ChatColor.WHITE + "§lDeathmatch: " + C.cGreen + "§l"
+ UtilTime.MakeStr(timeLeft));
}
else
{
GetObjectiveSide().setDisplayName(
ChatColor.WHITE + "§lDeathmatch");
_deathmatchLive = true; _deathmatchLive = true;
GetTeamList().get(0).SpawnTeleport(); GetTeamList().get(0).SpawnTeleport();
@ -1629,4 +1623,70 @@ public class SurvivalGames extends SoloGame
{ {
_redChunks.remove(event.getPlayer()); _redChunks.remove(event.getPlayer());
} }
@Override
@EventHandler
public void ScoreboardUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
return;
if (GetTeamList().isEmpty())
return;
Scoreboard.Reset();
Scoreboard.WriteBlank();
GameTeam team = GetTeamList().get(0);
if (team.GetPlayers(false).size() < 9)
{
for (Player player : team.GetPlayers(false))
{
if (team.IsAlive(player))
{
Scoreboard.Write(C.cGreen + player.getName());
}
else
{
Scoreboard.Write(C.cGray + player.getName());
}
}
}
else if (team.GetPlayers(true).size() < 9)
{
for (Player player : team.GetPlayers(true))
{
Scoreboard.Write(C.cGreen + player.getName());
}
}
else
{
Scoreboard.Write(C.cGreen + "Players Alive");
Scoreboard.Write("" + team.GetPlayers(true).size());
Scoreboard.WriteBlank();
Scoreboard.Write(C.cRed + "Players Dead");
Scoreboard.Write("" + (team.GetPlayers(false).size() - team.GetPlayers(true).size()));
}
if (_deathmatchCountdown)
{
if (event.getType() != UpdateType.TICK)
return;
long timeLeft = 60000 - (System.currentTimeMillis() - _deathmatchTime);
Scoreboard.WriteBlank();
Scoreboard.Write(C.cYellow + C.Bold + "Deathmatch");
Scoreboard.Write(UtilTime.MakeStr(Math.max(0, timeLeft), 0));
}
Scoreboard.Draw();
}
} }

View File

@ -157,6 +157,8 @@ public class SurvivalGamesTeams extends TeamGame
Manager.GetAntiStack().SetEnabled(false); Manager.GetAntiStack().SetEnabled(false);
this.GameTimeout = 9600000;
this.WorldTimeSet = 0; this.WorldTimeSet = 0;
this.WorldBoundaryKill = false; this.WorldBoundaryKill = false;
@ -1211,17 +1213,8 @@ public class SurvivalGamesTeams extends TeamGame
long timeLeft = 60000 - (System.currentTimeMillis() - _deathmatchTime); long timeLeft = 60000 - (System.currentTimeMillis() - _deathmatchTime);
if (timeLeft > 0) if (timeLeft <= 0)
{ {
GetObjectiveSide().setDisplayName(
ChatColor.WHITE + "§lDeathmatch: " + C.cGreen + "§l"
+ UtilTime.MakeStr(timeLeft));
}
else
{
GetObjectiveSide().setDisplayName(
ChatColor.WHITE + "§lDeathmatch");
_deathmatchLive = true; _deathmatchLive = true;
for (GameTeam team : GetTeamList()) for (GameTeam team : GetTeamList())

View File

@ -413,9 +413,6 @@ public class TurfForts extends TeamGame
{ {
time = _buildTime - (System.currentTimeMillis() - _phaseTime); time = _buildTime - (System.currentTimeMillis() - _phaseTime);
long displayTime = Math.max(0, time);
GetObjectiveSide().setDisplayName(ChatColor.WHITE + C.Bold + "Build Time " + C.cGreen + C.Bold+ UtilTime.MakeStr(displayTime));
if (time <= 0) if (time <= 0)
{ {
_fight = true; _fight = true;
@ -434,9 +431,6 @@ public class TurfForts extends TeamGame
{ {
time = _fightTime - (System.currentTimeMillis() - _phaseTime); time = _fightTime - (System.currentTimeMillis() - _phaseTime);
long displayTime = Math.max(0, time);
GetObjectiveSide().setDisplayName(ChatColor.WHITE + C.Bold + "Combat Time " + C.cGreen + C.Bold+ UtilTime.MakeStr(displayTime));
if (time <= 0) if (time <= 0)
{ {
_fight = false; _fight = false;
@ -465,19 +459,38 @@ public class TurfForts extends TeamGame
if (event.getType() != UpdateType.FAST) if (event.getType() != UpdateType.FAST)
return; return;
Scoreboard.Reset();
for (GameTeam team : this.GetTeamList()) for (GameTeam team : this.GetTeamList())
{ {
String name = team.GetColor() + team.GetName();
if (name.length() > 16)
name = name.substring(0, 16);
int lines = 0; int lines = 0;
if (team.GetColor() == ChatColor.RED) lines = GetRedLines(); if (team.GetColor() == ChatColor.RED) lines = GetRedLines();
else lines = GetBlueLines(); else lines = GetBlueLines();
Score score = GetObjectiveSide().getScore(name); Scoreboard.WriteBlank();
score.setScore(lines); Scoreboard.Write(lines + " " + team.GetColor() + team.GetName());
} }
if (!_fight)
{
long time = _buildTime - (System.currentTimeMillis() - _phaseTime);
Scoreboard.WriteBlank();
Scoreboard.Write(C.cYellow + C.Bold + "Build Time");
Scoreboard.Write(UtilTime.MakeStr(Math.max(0, time), 0));
}
else
{
long time = _fightTime - (System.currentTimeMillis() - _phaseTime);
Scoreboard.WriteBlank();
Scoreboard.Write(C.cYellow + C.Bold + "Combat Time");
Scoreboard.Write(UtilTime.MakeStr(Math.max(0, time), 0));
}
Scoreboard.Draw();
} }
public int GetRedLines() public int GetRedLines()

View File

@ -3,38 +3,24 @@ package nautilus.game.arcade.game.games.uhc;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Chunk;
import org.bukkit.Difficulty; import org.bukkit.Difficulty;
import org.bukkit.GameMode;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.World.Environment; import org.bukkit.World.Environment;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.block.BlockState;
import org.bukkit.craftbukkit.v1_7_R3.CraftServer;
import org.bukkit.craftbukkit.v1_7_R3.CraftWorld;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.EnderDragon;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Ghast; import org.bukkit.entity.Ghast;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Monster; import org.bukkit.entity.Monster;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.entity.EntityCreatePortalEvent;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDeathEvent; import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.EntityRegainHealthEvent; import org.bukkit.event.entity.EntityRegainHealthEvent;
@ -44,7 +30,6 @@ import org.bukkit.event.inventory.PrepareItemCraftEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerItemConsumeEvent; import org.bukkit.event.player.PlayerItemConsumeEvent;
import org.bukkit.event.player.PlayerKickEvent; import org.bukkit.event.player.PlayerKickEvent;
import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerPortalEvent; import org.bukkit.event.player.PlayerPortalEvent;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
@ -58,44 +43,41 @@ import org.bukkit.potion.PotionEffectType;
import org.bukkit.scoreboard.DisplaySlot; import org.bukkit.scoreboard.DisplaySlot;
import org.bukkit.scoreboard.Objective; import org.bukkit.scoreboard.Objective;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.MapUtil; import mineplex.core.common.util.MapUtil;
import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.TimeUtil;
import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.recharge.Recharge; import mineplex.core.recharge.Recharge;
import mineplex.core.timing.TimingManager;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.combat.CombatLog; import mineplex.minecraft.game.core.combat.CombatLog;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeFormat;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType; import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.game.TeamGame; import nautilus.game.arcade.game.TeamGame;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.managers.GameLobbyManager;
public class UHC extends TeamGame public class UHC extends TeamGame
{ {
private NautHashMap<String, Long> _deathTime = new NautHashMap<String, Long>(); private NautHashMap<String, Long> _deathTime = new NautHashMap<String, Long>();
private NautHashMap<String, Long> _combatTime = new NautHashMap<String, Long>();
private int _borderSize = 1250;
private int _borderSize = 1000;
private int _gameMinutes = 0; private int _gameMinutes = 0;
private int _safeTime = 10; private int _safeTime = 11;
private long _lastMinute = System.currentTimeMillis(); private long _lastMinute = System.currentTimeMillis();
private Objective _scoreObj; private Objective _scoreObj;
@ -116,7 +98,9 @@ public class UHC extends TeamGame
"Last player/team alive wins!" "Last player/team alive wins!"
}); });
this.DamageTeamSelf = true; this.GameTimeout = 10800000;
this.DamagePvP = false;
this.DeathDropItems = true; this.DeathDropItems = true;
@ -129,7 +113,7 @@ public class UHC extends TeamGame
this.InventoryOpen = true; this.InventoryOpen = true;
this.DeathOut = true; this.DeathOut = true;
this.QuitOut = true; this.QuitOut = false;
this.CreatureAllow = true; this.CreatureAllow = true;
@ -207,6 +191,29 @@ public class UHC extends TeamGame
Announce(ChatColor.WHITE + C.Bold + _gameMinutes + " minutes have passed."); Announce(ChatColor.WHITE + C.Bold + _gameMinutes + " minutes have passed.");
} }
} }
@EventHandler
public void EarlyGameUpdate(UpdateEvent event)
{
if (!IsLive())
return;
if (event.getType() != UpdateType.FAST)
return;
if (DamagePvP)
return;
WorldData.World.setTime(2000);
for (Player player : GetPlayers(true))
{
player.setSaturation(3f);
player.setExhaustion(0f);
player.setFoodLevel(20);
}
}
@EventHandler @EventHandler
public void GameStart(GameStateChangeEvent event) public void GameStart(GameStateChangeEvent event)
@ -233,6 +240,7 @@ public class UHC extends TeamGame
} }
} }
/*
@EventHandler @EventHandler
public void WorldBoundaryCheck(PlayerMoveEvent event) public void WorldBoundaryCheck(PlayerMoveEvent event)
{ {
@ -252,21 +260,32 @@ public class UHC extends TeamGame
Manager.GetCondition().Factory().Poison("Border", event.getPlayer(), event.getPlayer(), 1.9, 0, false, false, false); Manager.GetCondition().Factory().Poison("Border", event.getPlayer(), event.getPlayer(), 1.9, 0, false, false, false);
} }
} }
*/
@EventHandler @EventHandler
public void WorldBoundaryCheck(UpdateEvent event) public void WorldBoundaryCheck(UpdateEvent event)
{ {
if (event.getType() != UpdateType.FAST) if (event.getType() != UpdateType.FASTER)
return; return;
for (Player player : GetPlayers(true)) for (Player player : GetPlayers(true))
{ {
if (Math.abs(player.getLocation().getX()) + 5 < _borderSize && Math.abs(player.getLocation().getZ()) + 5 < _borderSize) //Damage
if (Math.abs(player.getLocation().getX()) > _borderSize || Math.abs(player.getLocation().getZ()) > _borderSize)
{
player.damage(0.75);
}
//Effect
if (Math.abs(player.getLocation().getX()) + 7 < _borderSize && Math.abs(player.getLocation().getZ()) + 7 < _borderSize)
continue; continue;
for (Block block : UtilBlock.getInRadius(player.getLocation(), 5d).keySet()) for (Block block : UtilBlock.getInRadius(player.getLocation(), 7d).keySet())
{ {
if (Math.abs(block.getX()) < _borderSize && Math.abs(block .getZ()) + 5 < _borderSize) if (Math.random() > 0.80)
continue;
if (Math.abs(block.getX()) < _borderSize && Math.abs(block .getZ()) < _borderSize)
continue; continue;
if (!UtilBlock.airFoliage(block)) if (!UtilBlock.airFoliage(block))
@ -275,7 +294,10 @@ public class UHC extends TeamGame
if (!UtilBlock.solid(block.getRelative(BlockFace.DOWN))) if (!UtilBlock.solid(block.getRelative(BlockFace.DOWN)))
continue; continue;
block.setType(Material.FIRE);
UtilParticle.PlayParticle(player, ParticleType.EXPLODE, block.getLocation(), (float)Math.random(), (float)Math.random(), (float)Math.random(), 0, 1);
player.playSound(block.getLocation(), Sound.FIZZ, 0.1f, 0.1f);
} }
} }
} }
@ -334,7 +356,7 @@ public class UHC extends TeamGame
team.GetSpawns().clear(); team.GetSpawns().clear();
} }
TimeUtil.start("UHC Spawn Generation"); TimingManager.start("UHC Spawn Generation");
//Solo Game //Solo Game
if (this.GetTeamList().size() == 1) if (this.GetTeamList().size() == 1)
@ -404,7 +426,7 @@ public class UHC extends TeamGame
team.GetSpawns().add(loc); team.GetSpawns().add(loc);
while (team.GetSpawns().size() < 5) while (team.GetSpawns().size() < 20)
{ {
Location other = GetRandomSpawn(loc); Location other = GetRandomSpawn(loc);
@ -413,7 +435,7 @@ public class UHC extends TeamGame
} }
} }
TimeUtil.stop("UHC Spawn Generation"); TimingManager.stop("UHC Spawn Generation");
} }
public Location GetRandomSpawn(Location around) public Location GetRandomSpawn(Location around)
@ -438,7 +460,7 @@ public class UHC extends TeamGame
//Get Radius Location //Get Radius Location
else else
{ {
block = UtilBlock.getHighest(WorldData.World, around.getBlockX() - 5 + UtilMath.r(10), around.getBlockZ() - 5 + UtilMath.r(10), ignore); block = UtilBlock.getHighest(WorldData.World, around.getBlockX() - 8 + UtilMath.r(16), around.getBlockZ() - 8 + UtilMath.r(16), ignore);
} }
//Check Validity //Check Validity
@ -505,22 +527,22 @@ public class UHC extends TeamGame
if (killer != null) if (killer != null)
{ {
Announce(Manager.GetColor(dead) + C.Bold + dead.getName() + Announce(Manager.GetColor(dead) + C.Bold + dead.getName() +
C.cWhite + C.Bold + " was killed by " + C.cGray + C.Bold + " was killed by " +
Manager.GetColor(killer) + C.Bold + killer.getName() + Manager.GetColor(killer) + C.Bold + killer.getName() +
C.cWhite + C.Bold + "."); C.cGray + C.Bold + ".");
} }
else else
{ {
if (log.GetAttackers().isEmpty()) if (log.GetAttackers().isEmpty())
{ {
Announce(Manager.GetColor(dead) + C.Bold + dead.getName() + Announce(Manager.GetColor(dead) + C.Bold + dead.getName() +
C.cWhite + C.Bold + " has died by unknown causes."); C.cGray + C.Bold + " has died by unknown causes.");
} }
else else
{ {
Announce(Manager.GetColor(dead) + C.Bold + dead.getName() + Announce(Manager.GetColor(dead) + C.Bold + dead.getName() +
C.cWhite + C.Bold + " was killed by " + log.GetAttackers().getFirst().GetName() + "."); C.cGray + C.Bold + " was killed by " + log.GetAttackers().getFirst().GetName() + ".");
} }
} }
} }
@ -540,7 +562,7 @@ public class UHC extends TeamGame
continue; continue;
_deathTime.remove(player.getName()); _deathTime.remove(player.getName());
Manager.GetPortal().SendPlayerToServer(player, "Lobby"); //XXX Need this ? Manager.GetPortal().SendPlayerToServer(player, "Lobby");
} }
} }
@ -550,7 +572,6 @@ public class UHC extends TeamGame
event.setLeaveMessage(null); event.setLeaveMessage(null);
} }
/*
@EventHandler(priority = EventPriority.LOWEST) @EventHandler(priority = EventPriority.LOWEST)
public void PlayerQuit(PlayerQuitEvent event) public void PlayerQuit(PlayerQuitEvent event)
{ {
@ -567,7 +588,7 @@ public class UHC extends TeamGame
if (player.isDead()) if (player.isDead())
return; return;
XXX /*
if (true) if (true)
{ {
//Announcement //Announcement
@ -576,6 +597,7 @@ public class UHC extends TeamGame
player.damage(5000); player.damage(5000);
return; return;
} }
*/
if (_combatTime.containsKey(player.getName()) && !UtilTime.elapsed(_combatTime.get(player.getName()), 15000)) if (_combatTime.containsKey(player.getName()) && !UtilTime.elapsed(_combatTime.get(player.getName()), 15000))
{ {
@ -586,14 +608,17 @@ public class UHC extends TeamGame
return; return;
} }
} }
*/
@EventHandler(priority=EventPriority.MONITOR)
@EventHandler public void DamageRecord(CustomDamageEvent event)
public void DamageCancel(CustomDamageEvent event)
{ {
if (_gameMinutes < _safeTime && event.GetDamagerPlayer(true) != null) if (event.IsCancelled())
return;
if (event.GetDamagerPlayer(true) != null && event.GetDamageePlayer() != null)
{ {
event.SetCancelled("Game Not Started"); _combatTime.put(event.GetDamageePlayer().getName(), System.currentTimeMillis());
_combatTime.put(event.GetDamagerPlayer(true).getName(), System.currentTimeMillis());
} }
} }
@ -620,8 +645,11 @@ public class UHC extends TeamGame
{ {
ArrayList<Entity> entList = ents.get(type); ArrayList<Entity> entList = ents.get(type);
int count = 0; int count = 0;
if (type == EntityType.DROPPED_ITEM)
continue;
while (entList.size() > 400) while (entList.size() > 500)
{ {
Entity ent = entList.remove(UtilMath.r(entList.size())); Entity ent = entList.remove(UtilMath.r(entList.size()));
ent.remove(); ent.remove();
@ -939,11 +967,11 @@ public class UHC extends TeamGame
//Solo //Solo
if (GetTeamList().size() == 1) if (GetTeamList().size() == 1)
{ {
if (GetPlayers(true).size() < 10) if (GetPlayers(true).size() < 8)
{ {
for (Player player : GetPlayers(true)) for (Player player : GetPlayers(true))
{ {
Scoreboard.WriteOrdered("Health", player.getName(), (int)player.getHealth(), true); Scoreboard.WriteOrdered("Health", player.getName(), GetHealth(player), true);
} }
} }
else else
@ -961,18 +989,18 @@ public class UHC extends TeamGame
if (team.IsTeamAlive()) if (team.IsTeamAlive())
aliveList.add(team); aliveList.add(team);
if (GetPlayers(true).size() < 10) if (GetPlayers(true).size() < 8)
{ {
for (Player player : GetPlayers(true)) for (Player player : GetPlayers(true))
{ {
Scoreboard.WriteOrdered("Health", GetTeam(player).GetColor() + player.getName(), (int)player.getHealth(), true); Scoreboard.WriteOrdered("Health", GetTeam(player).GetColor() + player.getName(), GetHealth(player), true);
} }
} }
else if (aliveList.size() < 10) else if (aliveList.size() < 8)
{ {
for (GameTeam team : aliveList) for (GameTeam team : aliveList)
{ {
Scoreboard.WriteOrdered("Players", team.GetName(), team.GetPlayers(true).size(), true); Scoreboard.WriteOrdered("Players", team.GetColor() + team.GetName(), team.GetPlayers(true).size(), true);
} }
} }
else else
@ -982,10 +1010,26 @@ public class UHC extends TeamGame
} }
} }
Scoreboard.WriteBlank();
Scoreboard.Write(C.cYellow + C.Bold + "Time");
Scoreboard.Write(UtilTime.MakeStr(System.currentTimeMillis() - GetStateTime()));
Scoreboard.WriteBlank(); Scoreboard.WriteBlank();
Scoreboard.Write(C.cYellow + C.Bold + "Borders"); Scoreboard.Write(C.cYellow + C.Bold + "Borders");
Scoreboard.Write("+-" + _borderSize); Scoreboard.Write("-" + _borderSize + " to " + "+" + _borderSize);
Scoreboard.Draw(); Scoreboard.Draw();
} }
public int GetHealth(Player player)
{
int health = (int)player.getHealth();
if (player.getHealth() % 1d != 0)
{
health += 1;
}
return health;
}
} }

View File

@ -359,8 +359,15 @@ public class ZombieSurvival extends SoloGame
if (_survivors == null || _undead == null) if (_survivors == null || _undead == null)
return; return;
GetObjectiveSide().getScore(_survivors.GetColor() + _survivors.GetName()).setScore(_survivors.GetPlayers(true).size()); Scoreboard.Reset();
GetObjectiveSide().getScore(_undead.GetColor() + _undead.GetName()).setScore(_undead.GetPlayers(true).size());
for (GameTeam team : this.GetTeamList())
{
Scoreboard.WriteBlank();
Scoreboard.Write(team.GetPlayers(true).size() + " " + team.GetColor() + team.GetName());
}
Scoreboard.Draw();
} }
@Override @Override

View File

@ -106,8 +106,16 @@ public class GameChatManager implements Listener
if (Manager.GetClients().Get(receiver).GetRank().Has(Rank.MODERATOR)) if (Manager.GetClients().Get(receiver).GetRank().Has(Rank.MODERATOR))
continue; continue;
GameTeam recTeam = Manager.GetGame().GetTeam(receiver);
GameTeam sendTeam = Manager.GetGame().GetTeam(sender);
if (recTeam == null || sendTeam == null)
{
continue;
}
if (Manager.GetGame().GetTeam(receiver) != null && Manager.GetGame().GetTeam(sender) != Manager.GetGame().GetTeam(receiver)) if (!recTeam.equals(sendTeam))
recipientIterator.remove(); recipientIterator.remove();
} }
} }

View File

@ -149,41 +149,10 @@ public class GameManager implements Listener
} }
else if (game.GetState() == GameState.Live && !Manager.IsTournamentServer()) else if (game.GetState() == GameState.Live && !Manager.IsTournamentServer())
{ {
if (game.GetType() == GameType.Bridge) if (UtilTime.elapsed(game.GetStateTime(), game.GameTimeout))
{ {
if (UtilTime.elapsed(game.GetStateTime(), 96000000)) game.SetState(GameState.End);
{
game.SetState(GameState.End);
}
} }
else if (game.GetType() == GameType.SurvivalGames)
{
if (UtilTime.elapsed(game.GetStateTime(), 9600000))
{
game.SetState(GameState.End);
}
}
else if (game.GetType().toString().toLowerCase().contains("teams"))
{
if (UtilTime.elapsed(game.GetStateTime(), 9600000))
{
game.SetState(GameState.End);
}
}
else if (game.GetType() != GameType.UHC)
{
if (UtilTime.elapsed(game.GetStateTime(), 10800000))
{
game.SetState(GameState.End);
}
}
else
{
if (UtilTime.elapsed(game.GetStateTime(), 1200000))
{
game.SetState(GameState.End);
}
}
} }
else if (game.GetState() == GameState.End) else if (game.GetState() == GameState.End)
{ {

View File

@ -37,7 +37,7 @@ public class GameScoreboard
_sideObjective = _scoreboard.registerNewObjective("Obj"+UtilMath.r(999999999), "dummy"); _sideObjective = _scoreboard.registerNewObjective("Obj"+UtilMath.r(999999999), "dummy");
_sideObjective.setDisplaySlot(DisplaySlot.SIDEBAR); _sideObjective.setDisplaySlot(DisplaySlot.SIDEBAR);
_sideObjective.setDisplayName(C.Bold + game.GetName()); _sideObjective.setDisplayName(C.Bold + " MINEPLEX ");
} }
public Scoreboard GetScoreboard() public Scoreboard GetScoreboard()

View File

@ -2,7 +2,6 @@
<classpath> <classpath>
<classpathentry kind="src" path="src"/> <classpathentry kind="src" path="src"/>
<classpathentry combineaccessrules="false" kind="src" path="/Core"/> <classpathentry combineaccessrules="false" kind="src" path="/Core"/>
<classpathentry combineaccessrules="false" kind="src" path="/Nautilus.Core"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry combineaccessrules="false" kind="src" path="/Nautilus.Core.CraftBukkit"/> <classpathentry combineaccessrules="false" kind="src" path="/Nautilus.Core.CraftBukkit"/>
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/craftbukkit.jar" sourcepath="/REPO_DIR/GitHubLibraries/CraftBukkit/src"/> <classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/craftbukkit.jar" sourcepath="/REPO_DIR/GitHubLibraries/CraftBukkit/src"/>