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 kind="var" path="REPO_DIR/Plugins/Libraries/bukkit.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Core"/>
<classpathentry combineaccessrules="false" kind="src" path="/Nautilus.Core"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@ -83,11 +83,25 @@ public class UtilTime
else type = TimeUnit.DAYS;
}
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";
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.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)

View File

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

View File

@ -61,6 +61,7 @@ import mineplex.core.stats.StatsManager;
import mineplex.core.task.TaskManager;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.hub.commands.ForcefieldRadius;
import mineplex.hub.commands.GadgetToggle;
import mineplex.hub.gadget.GadgetManager;
import mineplex.hub.modules.*;
@ -83,6 +84,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
private DonationManager _donationManager;
private DisguiseManager _disguiseManager;
private PartyManager _partyManager;
private ForcefieldManager _forcefieldManager;
private Portal _portal;
private StatsManager _statsManager;
private GadgetManager _gadgetManager;
@ -128,6 +130,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
new WorldManager(this);
new JumpManager(this);
new NewsManager(this);
_mountManager = new MountManager(this);
_gadgetManager = new GadgetManager(this, _mountManager, petManager);
@ -136,7 +139,10 @@ public class HubManager extends MiniClientPlugin<HubClient>
_preferences = preferences;
_tutorialManager = new TutorialManager(this, donationManager, taskManager, _textCreator);
_visibilityManager = new VisibilityManager(this);
_forcefieldManager = new ForcefieldManager(this);
AddCommand(new ForcefieldRadius(_forcefieldManager));
_statsManager = new StatsManager(plugin);
((CraftWorld)Bukkit.getWorlds().get(0)).getHandle().pvpMode = true;
@ -751,37 +757,6 @@ public class HubManager extends MiniClientPlugin<HubClient>
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
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.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.ArcadeManager;
@ -83,8 +84,15 @@ public class CompassAddon extends MiniPlugin
if (target != null)
{
if (!player.getInventory().contains(Material.COMPASS))
player.getInventory().addItem(new ItemStack(Material.COMPASS));
if (Manager.GetGame().CompassGiveItem)
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());
@ -146,9 +154,9 @@ public class CompassAddon extends MiniPlugin
}
@EventHandler
public void PlayerInteract(PlayerInteractEvent event)
public void SpectatorTeleport(PlayerInteractEvent event)
{
if (Manager.GetGame() == null || !Manager.GetGame().CompassEnabled)
if (Manager.GetGame() == null)
return;
Player player = event.getPlayer();
@ -159,6 +167,13 @@ public class CompassAddon extends MiniPlugin
if (Manager.GetGame().IsAlive(player))
return;
event.setCancelled(true);
if (!Recharge.Instance.use(player, "Spectate", 5000, true, false))
{
return;
}
GameTeam team = Manager.GetGame().GetTeam(player);
Player target = null;

View File

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

View File

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

View File

@ -225,8 +225,10 @@ public abstract class TeamGame extends Game
for (GameTeam team : this.GetTeamList())
{
//Display Individual Players
if (this.GetPlayers(true).size() < 16)
if (this.GetPlayers(true).size() < 13)
{
Scoreboard.WriteBlank();
for (Player player : team.GetPlayers(true))
{
Scoreboard.Write(team.GetColor() + player.getName());
@ -239,7 +241,7 @@ public abstract class TeamGame extends Game
Scoreboard.WriteBlank();
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;
import nautilus.game.arcade.game.PlayerScore;
import org.bukkit.entity.Player;
public class GameScore implements PlayerScore
public class GameScore
{
public org.bukkit.entity.Player Player;
public double Score;
public double Score;
public GameScore(Player player, double i)
{

View File

@ -130,6 +130,8 @@ public class Bridge extends TeamGame implements OreObsfucation
_ore = new OreHider();
// Flags
GameTimeout = 96000000;
DamageSelf = 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)
public void ChestProtect(EntityExplodeEvent event)
{
@ -1105,8 +1086,26 @@ public class Bridge extends TeamGame implements OreObsfucation
//Display Players Alive
if (!_tournament)
{
super.ScoreboardUpdate(event);
return;
for (GameTeam team : this.GetTeamList())
{
//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
else
@ -1119,12 +1118,27 @@ public class Bridge extends TeamGame implements OreObsfucation
Scoreboard.WriteBlank();
Scoreboard.Write(team.GetColor() + C.Bold + team.GetName());
Scoreboard.Write(team.GetColor() + " " + team.GetPlayers(true).size() + " Players");
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();
}

View File

@ -430,6 +430,26 @@ public class CastleSiege extends TeamGame
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();
}
@ -777,24 +797,6 @@ public class CastleSiege extends TeamGame
return;
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

View File

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

View File

@ -296,8 +296,10 @@ public class DragonEscape extends SoloGame
//Wipe Last
Scoreboard.Reset();
Scoreboard.WriteBlank();
//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);

View File

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

View File

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

View File

@ -953,14 +953,8 @@ public class HideSeek extends TeamGame
{
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;
//Hider Items
@ -978,18 +972,10 @@ public class HideSeek extends TeamGame
{
long timeLeft = _gameTime - (System.currentTimeMillis() - GetStateTime() - _hideTime);
if (timeLeft > 0)
{
GetObjectiveSide().setDisplayName(
ChatColor.WHITE + "§lHunt Time: " + C.cGreen + "§l"
+ UtilTime.MakeStr(timeLeft));
}
else
{
GetObjectiveSide().setDisplayName(
ChatColor.WHITE + "§lHunt Time: " + C.cGreen + "§l"
+ UtilTime.MakeStr(0));
if (timeLeft <= 0)
{
WriteScoreboard();
SetState(GameState.End);
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
public GameTeam ChooseTeam(Player player)

View File

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

View File

@ -185,9 +185,11 @@ public class MineWare extends SoloGame
Announce(C.cYellow + C.Bold + _order.GetOrder().toUpperCase());
/* XXX
GetObjectiveSide().setDisplayName(
ChatColor.WHITE + "§lMineWare " + C.cGreen + "§l"
+ "Round " + _orderCount);
*/
}
//Update Order
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.playSound(player.getLocation(), Sound.PISTON_EXTEND, 3f, 2f);
}
GetObjectiveSide().setDisplayName(C.cWhite + C.Bold + "First to " + C.cGold + C.Bold + "20 Kills");
}
@EventHandler
@ -260,12 +258,12 @@ public class Quiver extends SoloGame
//Wipe Last
Scoreboard.Reset();
Scoreboard.WriteBlank();
//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);
}

View File

@ -81,8 +81,6 @@ public class QuiverTeams extends TeamGame
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())
{
_teamKills.put(team, 0);
@ -194,7 +192,7 @@ public class QuiverTeams extends TeamGame
Scoreboard.WriteBlank();
Scoreboard.Write(team.GetColor() + team.GetName());
Scoreboard.Write(team.GetColor() + "" + kills + " Kills");
Scoreboard.Write(kills + "" + team.GetColor() + " Kills");
}
Scoreboard.Draw();

View File

@ -101,14 +101,14 @@ public class SheepGame extends TeamGame
"Return Sheep to your Team Pen!",
"Most sheep at 5 minutes wins!"
});
this.DeathOut = false;
this.DeathSpectateSecs = 8;
this.HungerSet = 20;
this.WorldTimeSet = 2000;
this.TeamArmor = true;
this.TeamArmorHotbar = true;
}
@ -200,7 +200,7 @@ public class SheepGame extends TeamGame
return;
Player player = event.getPlayer();
if (!Recharge.Instance.usable(player, "Sheep Stack"))
return;
@ -212,7 +212,7 @@ public class SheepGame extends TeamGame
if (!IsAlive(event.getPlayer()))
return;
if (player.getPassenger() != null && player.getPassenger() instanceof Player)
{
DropSheep(player);
@ -246,11 +246,11 @@ public class SheepGame extends TeamGame
data.SetHolder(event.getPlayer());
}
}
//Put Wool in Inventory
player.getInventory().setItem(4 + count, ItemStackFactory.Instance.CreateStack(35, ((Sheep)event.getRightClicked()).getColor().getWoolData()));
UtilInv.Update(player);
//Effect
event.getRightClicked().getWorld().playEffect(event.getRightClicked().getLocation(), Effect.STEP_SOUND, 35);
@ -260,7 +260,7 @@ public class SheepGame extends TeamGame
//Audio
player.playSound(player.getLocation(), Sound.SHEEP_IDLE, 2f, 3f);
}
@EventHandler
public void StackPlayer(PlayerInteractEntityEvent event)
{
@ -275,16 +275,16 @@ public class SheepGame extends TeamGame
Player player = event.getPlayer();
Player other = (Player)event.getRightClicked();
if (!(GetKit(player) instanceof KitBrute))
return;
if (!GetTeam(player).HasPlayer(other))
return;
if (player.getPassenger() != null)
DropSheep(player);
if (!Recharge.Instance.usable(player, "Sheep Stack"))
return;
@ -306,12 +306,12 @@ public class SheepGame extends TeamGame
//Audio
player.playSound(player.getLocation(), Sound.VILLAGER_YES, 2f, 3f);
other.playSound(player.getLocation(), Sound.VILLAGER_NO, 2f, 3f);
//Inform
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()) + "."));
}
@EventHandler
public void DeathDrop(PlayerDeathEvent event)
{
@ -389,7 +389,7 @@ public class SheepGame extends TeamGame
}
player.setExp(0.33f * (float)count);
//Inventory Wool Clean
if (count <= 0 && UtilGear.isMat(player.getInventory().getItem(4), Material.WOOL))
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);
}
@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
@EventHandler
public void ScoreboardUpdate(UpdateEvent event)
@ -489,6 +468,7 @@ public class SheepGame extends TeamGame
//Wipe Last
Scoreboard.Reset();
Scoreboard.WriteBlank();
//Write New
for (GameTeam team : _sheepPens.keySet())
@ -512,9 +492,16 @@ public class SheepGame extends TeamGame
return;
Scoreboard.WriteBlank();
Scoreboard.Write(C.Bold + "Next Sheep;");
Scoreboard.Write(C.cGreen + C.Bold + (int)UtilTime.convert(_sheepDelay - (System.currentTimeMillis() - _sheepTimer), 0, TimeUnit.FIT) + " Seconds");
Scoreboard.Write(C.cYellow + C.Bold + "Next Sheep");
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();
}
@ -629,7 +616,7 @@ public class SheepGame extends TeamGame
if (event.getMessage().contains("/giant"))
{
Giant giant = event.getPlayer().getWorld().spawn(event.getPlayer().getLocation(), Giant.class);
Entity top = giant;
for (int i=0 ; i < 10 ; i++)
{
@ -637,11 +624,11 @@ public class SheepGame extends TeamGame
top.setPassenger(buffer);
top = buffer;
}
top.setPassenger(event.getPlayer());
}
}
@EventHandler
public void Invul(CustomDamageEvent event)
{

View File

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

View File

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

View File

@ -24,7 +24,6 @@ import nautilus.game.arcade.kit.Kit;
public class SquidShooter extends SoloGame
{
private ArrayList<QuiverScore> _ranks = new ArrayList<QuiverScore>();
private ArrayList<String> _lastScoreboard = new ArrayList<String>();
public SquidShooter(ArcadeManager manager)
{
@ -52,17 +51,7 @@ public class SquidShooter extends SoloGame
this.SpawnDistanceRequirement = 16;
this.CompassEnabled = true;
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
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.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.survivalgames.kit.*;
@ -161,6 +162,8 @@ public class SurvivalGames extends SoloGame
Manager.GetAntiStack().SetEnabled(false);
this.GameTimeout = 9600000;
this.WorldTimeSet = 0;
this.WorldBoundaryKill = false;
@ -1207,17 +1210,8 @@ public class SurvivalGames extends SoloGame
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;
GetTeamList().get(0).SpawnTeleport();
@ -1629,4 +1623,70 @@ public class SurvivalGames extends SoloGame
{
_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);
this.GameTimeout = 9600000;
this.WorldTimeSet = 0;
this.WorldBoundaryKill = false;
@ -1211,17 +1213,8 @@ public class SurvivalGamesTeams extends TeamGame
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;
for (GameTeam team : GetTeamList())

View File

@ -413,9 +413,6 @@ public class TurfForts extends TeamGame
{
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)
{
_fight = true;
@ -434,9 +431,6 @@ public class TurfForts extends TeamGame
{
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)
{
_fight = false;
@ -465,19 +459,38 @@ public class TurfForts extends TeamGame
if (event.getType() != UpdateType.FAST)
return;
Scoreboard.Reset();
for (GameTeam team : this.GetTeamList())
{
String name = team.GetColor() + team.GetName();
if (name.length() > 16)
name = name.substring(0, 16);
int lines = 0;
if (team.GetColor() == ChatColor.RED) lines = GetRedLines();
else lines = GetBlueLines();
Score score = GetObjectiveSide().getScore(name);
score.setScore(lines);
Scoreboard.WriteBlank();
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()

View File

@ -3,38 +3,24 @@ package nautilus.game.arcade.game.games.uhc;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Chunk;
import org.bukkit.Difficulty;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.World.Environment;
import org.bukkit.block.Block;
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.entity.EnderDragon;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Ghast;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Monster;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.block.BlockBreakEvent;
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.EntityExplodeEvent;
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.PlayerItemConsumeEvent;
import org.bukkit.event.player.PlayerKickEvent;
import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerPortalEvent;
import org.bukkit.event.player.PlayerQuitEvent;
@ -58,44 +43,41 @@ import org.bukkit.potion.PotionEffectType;
import org.bukkit.scoreboard.DisplaySlot;
import org.bukkit.scoreboard.Objective;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.MapUtil;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.TimeUtil;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEvent;
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.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.recharge.Recharge;
import mineplex.core.timing.TimingManager;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.combat.CombatLog;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeFormat;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.game.TeamGame;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.managers.GameLobbyManager;
public class UHC extends TeamGame
{
private NautHashMap<String, Long> _deathTime = new NautHashMap<String, Long>();
private int _borderSize = 1250;
private NautHashMap<String, Long> _combatTime = new NautHashMap<String, Long>();
private int _borderSize = 1000;
private int _gameMinutes = 0;
private int _safeTime = 10;
private int _safeTime = 11;
private long _lastMinute = System.currentTimeMillis();
private Objective _scoreObj;
@ -116,7 +98,9 @@ public class UHC extends TeamGame
"Last player/team alive wins!"
});
this.DamageTeamSelf = true;
this.GameTimeout = 10800000;
this.DamagePvP = false;
this.DeathDropItems = true;
@ -129,7 +113,7 @@ public class UHC extends TeamGame
this.InventoryOpen = true;
this.DeathOut = true;
this.QuitOut = true;
this.QuitOut = false;
this.CreatureAllow = true;
@ -207,6 +191,29 @@ public class UHC extends TeamGame
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
public void GameStart(GameStateChangeEvent event)
@ -233,6 +240,7 @@ public class UHC extends TeamGame
}
}
/*
@EventHandler
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);
}
}
*/
@EventHandler
public void WorldBoundaryCheck(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
if (event.getType() != UpdateType.FASTER)
return;
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;
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;
if (!UtilBlock.airFoliage(block))
@ -275,7 +294,10 @@ public class UHC extends TeamGame
if (!UtilBlock.solid(block.getRelative(BlockFace.DOWN)))
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();
}
TimeUtil.start("UHC Spawn Generation");
TimingManager.start("UHC Spawn Generation");
//Solo Game
if (this.GetTeamList().size() == 1)
@ -404,7 +426,7 @@ public class UHC extends TeamGame
team.GetSpawns().add(loc);
while (team.GetSpawns().size() < 5)
while (team.GetSpawns().size() < 20)
{
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)
@ -438,7 +460,7 @@ public class UHC extends TeamGame
//Get Radius Location
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
@ -505,22 +527,22 @@ public class UHC extends TeamGame
if (killer != null)
{
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() +
C.cWhite + C.Bold + ".");
C.cGray + C.Bold + ".");
}
else
{
if (log.GetAttackers().isEmpty())
{
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
{
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;
_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);
}
/*
@EventHandler(priority = EventPriority.LOWEST)
public void PlayerQuit(PlayerQuitEvent event)
{
@ -567,7 +588,7 @@ public class UHC extends TeamGame
if (player.isDead())
return;
XXX
/*
if (true)
{
//Announcement
@ -576,6 +597,7 @@ public class UHC extends TeamGame
player.damage(5000);
return;
}
*/
if (_combatTime.containsKey(player.getName()) && !UtilTime.elapsed(_combatTime.get(player.getName()), 15000))
{
@ -586,14 +608,17 @@ public class UHC extends TeamGame
return;
}
}
*/
@EventHandler
public void DamageCancel(CustomDamageEvent event)
@EventHandler(priority=EventPriority.MONITOR)
public void DamageRecord(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);
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()));
ent.remove();
@ -939,11 +967,11 @@ public class UHC extends TeamGame
//Solo
if (GetTeamList().size() == 1)
{
if (GetPlayers(true).size() < 10)
if (GetPlayers(true).size() < 8)
{
for (Player player : GetPlayers(true))
{
Scoreboard.WriteOrdered("Health", player.getName(), (int)player.getHealth(), true);
Scoreboard.WriteOrdered("Health", player.getName(), GetHealth(player), true);
}
}
else
@ -961,18 +989,18 @@ public class UHC extends TeamGame
if (team.IsTeamAlive())
aliveList.add(team);
if (GetPlayers(true).size() < 10)
if (GetPlayers(true).size() < 8)
{
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)
{
Scoreboard.WriteOrdered("Players", team.GetName(), team.GetPlayers(true).size(), true);
Scoreboard.WriteOrdered("Players", team.GetColor() + team.GetName(), team.GetPlayers(true).size(), true);
}
}
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.Write(C.cYellow + C.Bold + "Borders");
Scoreboard.Write("+-" + _borderSize);
Scoreboard.Write("-" + _borderSize + " to " + "+" + _borderSize);
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)
return;
GetObjectiveSide().getScore(_survivors.GetColor() + _survivors.GetName()).setScore(_survivors.GetPlayers(true).size());
GetObjectiveSide().getScore(_undead.GetColor() + _undead.GetName()).setScore(_undead.GetPlayers(true).size());
Scoreboard.Reset();
for (GameTeam team : this.GetTeamList())
{
Scoreboard.WriteBlank();
Scoreboard.Write(team.GetPlayers(true).size() + " " + team.GetColor() + team.GetName());
}
Scoreboard.Draw();
}
@Override

View File

@ -106,8 +106,16 @@ public class GameChatManager implements Listener
if (Manager.GetClients().Get(receiver).GetRank().Has(Rank.MODERATOR))
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();
}
}

View File

@ -149,41 +149,10 @@ public class GameManager implements Listener
}
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)
{

View File

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

View File

@ -2,7 +2,6 @@
<classpath>
<classpathentry kind="src" path="src"/>
<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 combineaccessrules="false" kind="src" path="/Nautilus.Core.CraftBukkit"/>
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/craftbukkit.jar" sourcepath="/REPO_DIR/GitHubLibraries/CraftBukkit/src"/>