Merge branch 'master' of ssh://184.154.0.242:7999/min/Mineplex

This commit is contained in:
Jonathan Williams 2014-06-27 20:25:09 -07:00
commit 8e8e66f8c1
25 changed files with 549 additions and 946 deletions

View File

@ -1,6 +1,8 @@
package mineplex.core.portal;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.ArrayList;
@ -15,6 +17,7 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.plugin.messaging.PluginMessageListener;
import mineplex.core.MiniPlugin;
import mineplex.core.account.CoreClientManager;
@ -23,7 +26,7 @@ import mineplex.core.common.util.NautHashMap;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
public class Portal extends MiniPlugin
public class Portal extends MiniPlugin implements PluginMessageListener
{
private static Object _transferLock = new Object();
@ -34,12 +37,14 @@ public class Portal extends MiniPlugin
private boolean _retrieve = true;
private CoreClientManager _clientier;
private String serverName = "";
public Portal(JavaPlugin plugin)
{
super("Portal", plugin);
Bukkit.getMessenger().registerOutgoingPluginChannel(GetPlugin(), "BungeeCord");
Bukkit.getMessenger().registerIncomingPluginChannel(GetPlugin(), "BungeeCord", this);
_repository.initialize(plugin.getConfig().getBoolean("serverstatus.us"));
_clientier = CoreClientManager.Initialize(plugin, plugin.getConfig().getString("webServer"));
@ -93,6 +98,34 @@ public class Portal extends MiniPlugin
}
}, 20L);
}
private void ProcessServerName(final Player player)
{
ByteArrayOutputStream b = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(b);
try
{
out.writeUTF("GetServer");
}
catch (IOException e)
{
// Can never happen
}
finally
{
try
{
out.close();
}
catch (IOException e)
{
e.printStackTrace();
}
}
player.sendPluginMessage(GetPlugin(), "BungeeCord", b.toByteArray());
}
private void SendPlayerToServerWithMessage(Player player, String serverName)
{
@ -180,7 +213,8 @@ public class Portal extends MiniPlugin
if(args.length == 0)
{
player.sendMessage(ChatColor.YELLOW + "You are currently on server: " + ChatColor.GOLD + GetPlugin().getServer().getName() + " " + GetPlugin().getServer().getServerName());
ProcessServerName(player);
player.sendMessage(ChatColor.YELLOW + "You are currently on server: " + ChatColor.GOLD + serverName);
return;
}
else if(args.length == 1)
@ -256,4 +290,40 @@ public class Portal extends MiniPlugin
}
}
}
@Override
public void onPluginMessageReceived(String channel, Player player, byte[] message)
{
if (!channel.equals("BungeeCord"))
{
return;
}
DataInputStream in = new DataInputStream(new ByteArrayInputStream(message));
try
{
String subchannel = in.readUTF();
if (subchannel.equals("GetServer"))
{
serverName = in.readUTF();
}
}
catch (IOException e)
{
// Should never happen
}
finally
{
try
{
in.close();
}
catch (IOException e)
{
e.printStackTrace();
}
}
}
}

View File

@ -430,12 +430,6 @@ public class ArcadeManager extends MiniPlugin implements IRelation
if (_game == null || _game.GetState() == GameState.Recruit)
{
if (_game != null && _game.GetType() == GameType.UHC)
{
event.setMotd(ChatColor.RED + "UHC - Season 5");
return;
}
if (_game != null && _game.GetCountdown() != -1)
{
event.setMotd(ChatColor.GREEN + "Starting in " + _game.GetCountdown() + " Seconds" + extrainformation);

View File

@ -3,6 +3,7 @@ package nautilus.game.arcade.game;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import mineplex.core.timing.TimingManager;
import mineplex.core.updater.event.UpdateEvent;
@ -24,6 +25,7 @@ import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.events.PlayerGameRespawnEvent;
import nautilus.game.arcade.events.PlayerStateChangeEvent;
import nautilus.game.arcade.game.GameTeam.PlayerState;
import nautilus.game.arcade.game.games.GameScore;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
@ -371,6 +373,12 @@ public abstract class Game implements Listener
System.out.println("Created Team: " + team.GetName());
}
public void RemoveTeam(GameTeam team)
{
if (GetTeamList().remove(team))
System.out.println("Deleted Team: " + team.GetName());
}
public boolean HasTeam(GameTeam team)
{
@ -1000,4 +1008,13 @@ public abstract class Game implements Listener
{
return _prepareCountdown;
}
@EventHandler
public void TeamPlayerPlacement(PlayerStateChangeEvent event)
{
GameTeam team = GetTeam(event.GetPlayer());
if (team != null)
team.SetPlacement(event.GetPlayer(), event.GetState());
}
}

View File

@ -10,6 +10,7 @@ import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import nautilus.game.arcade.game.GameTeam.PlayerState;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
@ -65,6 +66,9 @@ public class GameTeam
private int _spawnDistance = 0;
private boolean _visible = true;
//Records order players go out in
protected ArrayList<Player> _places = new ArrayList<Player>();
public GameTeam(Game host, String name, ChatColor color, ArrayList<Location> spawns)
{
@ -338,4 +342,36 @@ public class GameTeam
{
return _respawnTime;
}
public void SetPlacement(Player player, PlayerState state)
{
if (state == PlayerState.OUT)
if (!_places.contains(player))
_places.add(0, player);
else
_places.remove(player);
}
public ArrayList<Player> GetPlacements(boolean includeAlivePlayers)
{
if (includeAlivePlayers)
{
ArrayList<Player> placesClone = new ArrayList<Player>();
for (Player player : _places)
{
placesClone.add(player);
}
for (Player player : GetPlayers(true))
{
_places.add(0, player);
}
return placesClone;
}
return _places;
}
}

View File

@ -19,86 +19,70 @@ import nautilus.game.arcade.kit.Kit;
public abstract class SoloGame extends Game
{
protected ArrayList<Player> _places = new ArrayList<Player>();
private GameTeam _players;
public SoloGame(ArcadeManager manager, GameType gameType, Kit[] kits, String[] gameDesc)
{
super(manager, gameType, kits, gameDesc);
}
@EventHandler
public void CustomTeamGeneration(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Recruit)
return;
this.GetTeamList().get(0).SetColor(ChatColor.YELLOW);
this.GetTeamList().get(0).SetName("Players");
_players = GetTeamList().get(0);
_players.SetColor(ChatColor.YELLOW);
_players.SetName("Players");
}
@EventHandler
public void EndStateChange(PlayerStateChangeEvent event)
{
if (event.GetState() == PlayerState.OUT)
if (!_places.contains(event.GetPlayer()))
_places.add(0, event.GetPlayer());
else
_places.remove(event.GetPlayer());
}
@Override
public void EndCheck()
{
if (!IsLive())
return;
//Add Winner
if (GetPlayers(true).size() == 1)
{
SetPlayerState(GetPlayers(true).get(0), PlayerState.OUT);
return;
}
if (GetPlayers(true).size() <= 0)
if (GetPlayers(true).size() <= 1)
{
ArrayList<Player> places = _players.GetPlacements(true);
//Announce
AnnounceEnd(_places);
AnnounceEnd(places);
//Gems
if (_places.size() >= 1)
AddGems(_places.get(0), 20, "1st Place", false);
if (_places.size() >= 2)
AddGems(_places.get(1), 15, "2nd Place", false);
if (_places.size() >= 3)
AddGems(_places.get(2), 10, "3rd Place", false);
if (places.size() >= 1)
AddGems(places.get(0), 20, "1st Place", false);
if (places.size() >= 2)
AddGems(places.get(1), 15, "2nd Place", false);
if (places.size() >= 3)
AddGems(places.get(2), 10, "3rd Place", false);
for (Player player : GetPlayers(false))
if (player.isOnline())
AddGems(player, 10, "Participation", false);
//End
SetState(GameState.End);
}
}
@Override
@EventHandler
public void ScoreboardUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
return;
if (GetTeamList().isEmpty())
return;
Scoreboard.Reset();
GameTeam team = GetTeamList().get(0);
if (team.GetPlayers(false).size() < 16)
{
for (Player player : team.GetPlayers(false))
@ -123,23 +107,18 @@ public abstract class SoloGame extends Game
else
{
Scoreboard.WriteBlank();
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()));
}
Scoreboard.Draw();
}
public ArrayList<Player> GetPlaces()
{
return _places;
}
public int GetScoreboardScore(Player player)
{
return 0;

View File

@ -18,10 +18,14 @@ import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.PlayerStateChangeEvent;
import nautilus.game.arcade.game.GameTeam.PlayerState;
import nautilus.game.arcade.kit.Kit;
public abstract class TeamGame extends Game
{
protected ArrayList<GameTeam> _places = new ArrayList<GameTeam>();
private NautHashMap<String, Long> _rejoinTime = new NautHashMap<String, Long>();
protected NautHashMap<String, GameTeam> RejoinTeam = new NautHashMap<String, GameTeam>();
protected NautHashMap<String, Kit> RejoinKit = new NautHashMap<String, Kit>();
@ -33,6 +37,26 @@ public abstract class TeamGame extends Game
super(manager, gameType, kits, gameDesc);
}
@EventHandler
public void EndStateChange(PlayerStateChangeEvent event)
{
GameTeam team = this.GetTeam(event.GetPlayer());
if (team == null)
return;
if (event.GetState() == PlayerState.OUT)
if (!team.IsTeamAlive())
_places.add(0, team);
else
_places.remove(team);
}
public ArrayList<GameTeam> GetPlaces()
{
return _places;
}
@EventHandler(priority = EventPriority.LOWEST)
public void PlayerQuit(PlayerQuitEvent event)
{

View File

@ -1,8 +1,10 @@
package nautilus.game.arcade.game.games;
import nautilus.game.arcade.game.PlayerScore;
import org.bukkit.entity.Player;
public class GameScore
public class GameScore implements PlayerScore
{
public org.bukkit.entity.Player Player;
public double Score;
@ -12,4 +14,9 @@ public class GameScore
Player = player;
Score = i;
}
public Player GetPlayer()
{
return Player;
}
}

View File

@ -38,36 +38,6 @@ public class BaconBrawl extends SoloGame
this.PrepareFreeze = false;
}
@Override
public void EndCheck()
{
if (!IsLive())
return;
if (GetPlayers(true).size() <= 1)
{
if (GetPlayers(true).size() == 1)
GetPlaces().add(0, GetPlayers(true).get(0));
if (GetPlaces().size() >= 1)
AddGems(GetPlaces().get(0), 15, "1st Place", false);
if (GetPlaces().size() >= 2)
AddGems(GetPlaces().get(1), 10, "2nd Place", false);
if (GetPlaces().size() >= 3)
AddGems(GetPlaces().get(2), 5, "3rd Place", false);
for (Player player : GetPlayers(false))
if (player.isOnline())
AddGems(player, 10, "Participation", false);
SetState(GameState.End);
AnnounceEnd(GetPlaces());
}
}
@EventHandler
public void Hunger(UpdateEvent event)
{

View File

@ -60,36 +60,6 @@ public class Barbarians extends SoloGame
this.BlockBreakAllow.add(136);
}
@Override
public void EndCheck()
{
if (!IsLive())
return;
if (GetPlayers(true).size() <= 1)
{
if (GetPlayers(true).size() == 1)
GetPlaces().add(0, GetPlayers(true).get(0));
if (GetPlaces().size() >= 1)
AddGems(GetPlaces().get(0), 15, "1st Place", false);
if (GetPlaces().size() >= 2)
AddGems(GetPlaces().get(1), 10, "2nd Place", false);
if (GetPlaces().size() >= 3)
AddGems(GetPlaces().get(2), 5, "3rd Place", false);
for (Player player : GetPlayers(false))
if (player.isOnline())
AddGems(player, 10, "Participation", false);
SetState(GameState.End);
AnnounceEnd(GetPlaces());
}
}
@EventHandler
public void BlockDamage(BlockDamageEvent event)
{

View File

@ -1,5 +1,7 @@
package nautilus.game.arcade.game.games.deathtag;
import java.util.ArrayList;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
@ -20,6 +22,7 @@ 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.GameTeam.PlayerState;
import nautilus.game.arcade.game.games.deathtag.kits.*;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.NullKit;
@ -30,7 +33,7 @@ public class DeathTag extends SoloGame
private GameTeam _chasers;
private NautHashMap<Player, Location> _deathLocation = new NautHashMap<Player, Location>();
private int _currentSpeed = -1;
public DeathTag(ArcadeManager manager)
@ -56,9 +59,9 @@ public class DeathTag extends SoloGame
this.DeathOut = false;
this.HungerSet = 20;
this.CompassEnabled = true;
this.PrepareFreeze = false;
}
@ -106,7 +109,7 @@ public class DeathTag extends SoloGame
{
return _runners;
}
@EventHandler
public void UpdateSpeed(UpdateEvent event)
{
@ -115,9 +118,9 @@ public class DeathTag extends SoloGame
if (event.getType() != UpdateType.SLOW)
return;
double ratio = (double)_chasers.GetPlayers(false).size() / (double)GetPlayers(false).size();
if (_currentSpeed == -1 && ratio > 0.25)
{
Announce(C.cGreen + C.Bold + "Runners receive Speed I");
@ -134,7 +137,7 @@ public class DeathTag extends SoloGame
_currentSpeed = 2;
}
}
@EventHandler
public void ApplyConditions(UpdateEvent event)
{
@ -143,17 +146,17 @@ public class DeathTag extends SoloGame
if (event.getType() != UpdateType.FAST)
return;
if (_currentSpeed >= 0)
for (Player player : _runners.GetPlayers(false))
{
Manager.GetCondition().Factory().Speed("Runner", player, player, 1.9, _currentSpeed, false, false, true);
}
for (Player player : _chasers.GetPlayers(false))
{
Manager.GetCondition().Factory().Regen("Undying", player, player, 1.9, 4, false, false, false);
if (_currentSpeed < 0)
Manager.GetCondition().Factory().Speed("Haste", player, player, 1.9, 0, false, false, true);
}
@ -189,15 +192,16 @@ public class DeathTag extends SoloGame
public void SetChaser(Player player, boolean forced)
{
if (!GetPlaces().contains(player))
GetPlaces().add(0, player);
//Set them as OUT!
if (GetTeam(player) != null)
GetTeam(player).SetPlacement(player, PlayerState.OUT);
SetPlayerTeam(player, _chasers);
//Kit
Kit newKit = GetKits()[5]; //Normal
if (forced) newKit = GetKits()[4]; //Alpha
SetKit(player, newKit, false);
newKit.ApplyKit(player);
@ -262,24 +266,24 @@ public class DeathTag extends SoloGame
if (_runners.GetPlayers(true).size() <= 1)
{
if (_runners.GetPlayers(true).size() == 1)
GetPlaces().add(0, GetPlayers(true).get(0));
ArrayList<Player> places = _runners.GetPlacements(true);
if (GetPlaces().size() >= 1)
AddGems(GetPlaces().get(0), 15, "1st Place", false);
if (places.size() >= 1)
AddGems(places.get(0), 15, "1st Place", false);
if (GetPlaces().size() >= 2)
AddGems(GetPlaces().get(1), 10, "2nd Place", false);
if (places.size() >= 2)
AddGems(places.get(1), 10, "2nd Place", false);
if (GetPlaces().size() >= 3)
AddGems(GetPlaces().get(2), 5, "3rd Place", false);
if (places.size() >= 3)
AddGems(places.get(2), 5, "3rd Place", false);
for (Player player : GetPlayers(false))
if (player.isOnline())
AddGems(player, 10, "Participation", false);
AnnounceEnd(places);
SetState(GameState.End);
AnnounceEnd(GetPlaces());
}
}
@ -307,7 +311,7 @@ public class DeathTag extends SoloGame
return true;
}
@Override
public double GetKillsGems(Player killer, Player killed, boolean assist)
{
@ -315,7 +319,7 @@ public class DeathTag extends SoloGame
{
return 4;
}
return 0;
}
}

View File

@ -350,26 +350,25 @@ public class DragonEscape extends SoloGame
{
SortScores();
_places.clear();
ArrayList<Player> places = new ArrayList<Player>();
for (DragonScore score : _ranks)
_places.add(score.Player);
places.add(score.Player);
//Announce
AnnounceEnd(_places);
AnnounceEnd(places);
//Gems
if (_winner != null)
AddGems(_winner, 10, "Course Complete", false);
if (_places.size() >= 1)
AddGems(_places.get(0), 20, "1st Place", false);
if (places.size() >= 1)
AddGems(places.get(0), 20, "1st Place", false);
if (_places.size() >= 2)
AddGems(_places.get(1), 15, "2nd Place", false);
if (places.size() >= 2)
AddGems(places.get(1), 15, "2nd Place", false);
if (_places.size() >= 3)
AddGems(_places.get(2), 10, "3rd Place", false);
if (places.size() >= 3)
AddGems(places.get(2), 10, "3rd Place", false);
for (Player player : GetPlayers(false))
if (player.isOnline())

View File

@ -580,9 +580,9 @@ public class Draw extends SoloGame
SortScores();
//Set Places
_places.clear();
ArrayList<Player> places = new ArrayList<Player>();
for (int i=0 ; i<_ranks.size() ; i++)
_places.add(i, _ranks.get(i).Player);
places.add(i, _ranks.get(i).Player);
//Award Gems
if (_ranks.size() >= 1)
@ -600,7 +600,7 @@ public class Draw extends SoloGame
AddGems(player, 10, "Participation", false);
SetState(GameState.End);
AnnounceEnd(_places);
AnnounceEnd(places);
}
}

View File

@ -257,9 +257,9 @@ public class Evolution extends SoloGame
SortScores();
//Set Places
_places.clear();
ArrayList<Player> places = new ArrayList<Player>();
for (int i=0 ; i<_ranks.size() ; i++)
_places.add(i, _ranks.get(i).Player);
places.add(i, _ranks.get(i).Player);
//Award Gems
if (_ranks.size() >= 1)
@ -277,7 +277,7 @@ public class Evolution extends SoloGame
AddGems(player, 10, "Participation", false);
SetState(GameState.End);
AnnounceEnd(_places);
AnnounceEnd(places);
}
@Override

View File

@ -42,6 +42,7 @@ 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.GameTeam.PlayerState;
import nautilus.game.arcade.game.games.milkcow.kits.*;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.NullKit;
@ -279,8 +280,9 @@ public class MilkCow extends SoloGame
public void SetCow(Player player, boolean forced)
{
if (!GetPlaces().contains(player))
GetPlaces().add(0, player);
//Set them as OUT!
if (GetTeam(player) != null)
GetTeam(player).SetPlacement(player, PlayerState.OUT);
SetPlayerTeam(player, _cows);
@ -424,9 +426,9 @@ public class MilkCow extends SoloGame
SortScores();
//Set Places
_places.clear();
ArrayList<Player> places = new ArrayList<Player>();
for (int i=0 ; i<_ranks.size() ; i++)
_places.add(i, _ranks.get(i).Player);
places.add(i, _ranks.get(i).Player);
//Award Gems
if (_ranks.size() >= 1)
@ -444,7 +446,7 @@ public class MilkCow extends SoloGame
AddGems(player, 10, "Participation", false);
SetState(GameState.End);
AnnounceEnd(_places);
AnnounceEnd(places);
}
@Override

View File

@ -289,9 +289,9 @@ public class Quiver extends SoloGame
if ((!_ranks.isEmpty() && _ranks.get(0).Kills >= 20) || GetPlayers(true).size() <= 1)
{
//Set Places
_places.clear();
ArrayList<Player> places = new ArrayList<Player>();
for (int i=0 ; i<_ranks.size() ; i++)
_places.add(i, _ranks.get(i).Player);
places.add(i, _ranks.get(i).Player);
//Award Gems
if (_ranks.size() >= 1)
@ -323,7 +323,7 @@ public class Quiver extends SoloGame
AddGems(player, 10, "Participation", false);
SetState(GameState.End);
AnnounceEnd(_places);
AnnounceEnd(places);
}
}
}

View File

@ -171,10 +171,11 @@ public class SquidShooter extends SoloGame
if ((!_ranks.isEmpty() && _ranks.get(0).Kills >= 20) || GetPlayers(true).size() <= 1)
{
ArrayList<Player> places = new ArrayList<Player>();
//Set Places
_places.clear();
for (int i=0 ; i<_ranks.size() ; i++)
_places.add(i, _ranks.get(i).Player);
places.add(i, _ranks.get(i).Player);
//Award Gems
if (_ranks.size() >= 1)
@ -192,7 +193,7 @@ public class SquidShooter extends SoloGame
AddGems(player, 10, "Participation", false);
SetState(GameState.End);
AnnounceEnd(_places);
AnnounceEnd(places);
}
}
}

View File

@ -1,5 +1,6 @@
package nautilus.game.arcade.game.games.zombiesurvival;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
@ -29,6 +30,7 @@ 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.GameTeam.PlayerState;
import nautilus.game.arcade.game.games.zombiesurvival.kits.*;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.NullKit;
@ -141,9 +143,11 @@ public class ZombieSurvival extends SoloGame
public void SetChaser(Player player, boolean forced)
{
if (!GetPlaces().contains(player))
GetPlaces().add(0, player);
//Set them as OUT!
if (GetTeam(player) != null)
GetTeam(player).SetPlacement(player, PlayerState.OUT);
//Change to Undead
SetPlayerTeam(player, _undead);
//Kit
@ -323,35 +327,25 @@ public class ZombieSurvival extends SoloGame
if (_survivors.GetPlayers(true).size() <= 1)
{
if (_survivors.GetPlayers(true).size() == 1)
GetPlaces().add(0, GetPlayers(true).get(0));
ArrayList<Player> places = _survivors.GetPlacements(true);
if (places.size() >= 1)
AddGems(places.get(0), 15, "1st Place", false);
if (GetPlaces().size() >= 1)
AddGems(GetPlaces().get(0), 15, "1st Place", false);
if (places.size() >= 2)
AddGems(places.get(1), 10, "2nd Place", false);
if (GetPlaces().size() >= 2)
AddGems(GetPlaces().get(1), 10, "2nd Place", false);
if (places.size() >= 3)
AddGems(places.get(2), 5, "3rd Place", false);
if (GetPlaces().size() >= 3)
AddGems(GetPlaces().get(2), 5, "3rd Place", false);
/*
int sections = GetPlaces().size()/10;
for (int i=0 ; i<5 ; i++)
{
for (int j=i*sections ; j < j*sections + sections ; j++)
{
AddGems(GetPlaces().get(j), 5-i, "Top " + ((i+1)*10) + "%", false);
}
}
*/
for (Player player : GetPlayers(false))
if (player.isOnline())
AddGems(player, 10, "Participation", false);
AnnounceEnd(places);
SetState(GameState.End);
AnnounceEnd(GetPlaces());
}
}

View File

@ -61,10 +61,10 @@ public class GameChatManager implements Listener
//Rank Prefix
String rankStr = "";
if (rank != Rank.ALL && (Manager.GetGame() != null && Manager.GetGame().GetType() != GameType.UHC))
if (rank != Rank.ALL)
rankStr = rank.GetTag(true, true) + " ";
if (ownsUltra && !rank.Has(Rank.ULTRA) && (Manager.GetGame() != null && Manager.GetGame().GetType() != GameType.UHC))
if (ownsUltra && !rank.Has(Rank.ULTRA))
rankStr = Rank.ULTRA.GetTag(true, true) + " ";
//Base Format
@ -91,11 +91,6 @@ public class GameChatManager implements Listener
{
globalMessage = true;
event.setFormat(dead + rankStr + team.GetColor() + "%1$s " + C.cWhite + "%2$s");
if (Manager.GetGame().GetType() == GameType.UHC)
event.setFormat(ChatColor.YELLOW + "%1$s " + ChatColor.WHITE + "%2$s");
else
event.setFormat(dead + rankStr + team.GetColor() + "%1$s " + C.cWhite + "%2$s");
}
}

View File

@ -132,9 +132,6 @@ public class GameGemManager implements Listener
if (Manager.IsTournamentServer())
return;
if (game.GetType() == GameType.UHC)
return;
//Inform Gems
AnnounceGems(game, player, game.GetPlayerGems().get(player), give);

View File

@ -302,22 +302,9 @@ public class GameLobbyManager implements IPacketRunnable, Listener
CreateScoreboards();
return;
}
//UHC Empty
if (game.GetTeamList().size() > 10 && game.GetType() == GameType.UHC)
{
WriteTeamLine("Season", 0, 159, (byte)15);
WriteTeamLine("7", 1, 159, (byte)4);
WriteKitLine("Season", 0, 159, (byte)15);
WriteKitLine("7", 1, 159, (byte)4);
CreateScoreboards();
return;
}
//Standard
if (game.GetKits().length > 1 || game.GetType() != GameType.UHC)
if (game.GetKits().length > 1 || game.GetTeamList().size() < 6)
{
//Display
ArrayList<GameTeam> teams = new ArrayList<GameTeam>();

View File

@ -171,6 +171,13 @@ public class GameManager implements Listener
}
}
else if (game.GetType() != GameType.UHC)
{
if (UtilTime.elapsed(game.GetStateTime(), 10800000))
{
game.SetState(GameState.End);
}
}
else
{
if (UtilTime.elapsed(game.GetStateTime(), 1200000))
{

View File

@ -218,19 +218,6 @@ public class GamePlayerManager implements Listener
if (past != null)
{
game.RemoveTeamPreference(player);
if (game.GetType() == GameType.UHC)
{
String players = "";
for (Player other : game.GetTeamPreferences().get(past))
players += other.getName() + " ";
if (players.length() > 0)
players = players.substring(0, players.length()-1);
for (Player other : game.GetTeamPreferences().get(past))
UtilPlayer.message(other, past.GetFormattedName() + " Team: " + ChatColor.RESET + players);
}
}
if (!game.GetTeamPreferences().containsKey(team))
@ -239,22 +226,7 @@ public class GamePlayerManager implements Listener
game.GetTeamPreferences().get(team).add(player);
}
if (game.GetType() == GameType.UHC)
{
String players = "";
for (Player other : game.GetTeamPreferences().get(team))
players += other.getName() + " ";
if (players.length() > 0)
players = players.substring(0, players.length()-1);
for (Player other : game.GetTeamPreferences().get(team))
UtilPlayer.message(other, team.GetFormattedName() + " Team: " + ChatColor.RESET + players);
}
else
{
UtilPlayer.message(player, F.main("Team", "You are " + F.elem(game.GetTeamQueuePosition(player)) + " in queue for " + F.elem(team.GetFormattedName() + " Team") + "."));
}
UtilPlayer.message(player, F.main("Team", "You are " + F.elem(game.GetTeamQueuePosition(player)) + " in queue for " + F.elem(team.GetFormattedName() + " Team") + "."));
}
@EventHandler(priority = EventPriority.LOWEST)

View File

@ -119,10 +119,7 @@ public class MiscManager implements Listener
if (Manager.GetGame() == null)
return;
if (Manager.GetGame().GetType() == GameType.UHC)
return;
for (Player player : UtilServer.getPlayers())
{
if (!Manager.GetGame().IsAlive(player))

View File

@ -49,6 +49,11 @@ public class GameScoreboard
{
return _sideObjective;
}
public String ParseTeamName(String name)
{
return name.substring(0, Math.min(16, name.length()));
}
public void CreateTeams()
{
@ -57,16 +62,7 @@ public class GameScoreboard
//Base Groups
for (Rank rank : Rank.values())
{
//Spectator
if (rank == Rank.ALL)
{
_scoreboard.registerNewTeam(rank.Name + "SPEC").setPrefix(ChatColor.GRAY + "");
}
else
{
_scoreboard.registerNewTeam(rank.Name + "SPEC").setPrefix(ChatColor.GRAY + "");
//_scoreboard.registerNewTeam(rank.Name + "SPEC").setPrefix(rank.Color + C.Bold + rank.Name.toUpperCase() + ChatColor.RESET + " " + ChatColor.GRAY);
}
_scoreboard.registerNewTeam(ParseTeamName(rank.Name + "SPEC")).setPrefix(ChatColor.GRAY + "");
}
//Team Groups
@ -74,15 +70,7 @@ public class GameScoreboard
{
for (Rank rank : Rank.values())
{
if (rank == Rank.ALL)
{
_scoreboard.registerNewTeam(rank.Name + team.GetName().toUpperCase()).setPrefix(team.GetColor() + "");
}
else
{
//_scoreboard.registerNewTeam(rank.Name + team.GetName().toUpperCase()).setPrefix(rank.Color + C.Bold + rank.Name.toUpperCase() + ChatColor.RESET + " " + team.GetColor());
_scoreboard.registerNewTeam(rank.Name + team.GetName().toUpperCase()).setPrefix(team.GetColor() + "");
}
_scoreboard.registerNewTeam(ParseTeamName(rank.Name + team.GetName().toUpperCase())).setPrefix(team.GetColor() + "");
}
}
}
@ -95,7 +83,7 @@ public class GameScoreboard
if (teamName == null)
teamName = "";
String team = Game.Manager.GetClients().Get(player).GetRank().Name + teamName;
String team = ParseTeamName(Game.Manager.GetClients().Get(player).GetRank().Name + teamName);
try
{