Merge branch 'master' of ssh://184.154.0.242:7999/min/Mineplex
This commit is contained in:
commit
8e8e66f8c1
@ -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"));
|
||||
@ -94,6 +99,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)
|
||||
{
|
||||
SendPlayerToServer(player, 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
@ -372,6 +374,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)
|
||||
{
|
||||
for (GameTeam cur : GetTeamList())
|
||||
@ -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());
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
@ -66,6 +67,9 @@ public class GameTeam
|
||||
|
||||
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)
|
||||
{
|
||||
Host = host;
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ 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)
|
||||
{
|
||||
@ -32,19 +32,9 @@ public abstract class SoloGame extends Game
|
||||
if (event.GetState() != GameState.Recruit)
|
||||
return;
|
||||
|
||||
this.GetTeamList().get(0).SetColor(ChatColor.YELLOW);
|
||||
this.GetTeamList().get(0).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());
|
||||
_players = GetTeamList().get(0);
|
||||
_players.SetColor(ChatColor.YELLOW);
|
||||
_players.SetName("Players");
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -53,27 +43,22 @@ public abstract class SoloGame extends Game
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
//Add Winner
|
||||
if (GetPlayers(true).size() == 1)
|
||||
if (GetPlayers(true).size() <= 1)
|
||||
{
|
||||
SetPlayerState(GetPlayers(true).get(0), PlayerState.OUT);
|
||||
return;
|
||||
}
|
||||
ArrayList<Player> places = _players.GetPlacements(true);
|
||||
|
||||
if (GetPlayers(true).size() <= 0)
|
||||
{
|
||||
//Announce
|
||||
AnnounceEnd(_places);
|
||||
AnnounceEnd(places);
|
||||
|
||||
//Gems
|
||||
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())
|
||||
@ -81,7 +66,6 @@ public abstract class SoloGame extends Game
|
||||
|
||||
//End
|
||||
SetState(GameState.End);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -135,11 +119,6 @@ public abstract class SoloGame extends Game
|
||||
Scoreboard.Draw();
|
||||
}
|
||||
|
||||
public ArrayList<Player> GetPlaces()
|
||||
{
|
||||
return _places;
|
||||
}
|
||||
|
||||
public int GetScoreboardScore(Player player)
|
||||
{
|
||||
return 0;
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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;
|
||||
@ -189,8 +192,9 @@ 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);
|
||||
|
||||
@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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())
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -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 (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);
|
||||
/*
|
||||
int sections = GetPlaces().size()/10;
|
||||
if (places.size() >= 3)
|
||||
AddGems(places.get(2), 5, "3rd Place", false);
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -303,21 +303,8 @@ public class GameLobbyManager implements IPacketRunnable, Listener
|
||||
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>();
|
||||
|
@ -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))
|
||||
{
|
||||
|
@ -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,23 +226,8 @@ 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") + "."));
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void KitInteract(PlayerInteractEntityEvent event)
|
||||
|
@ -120,9 +120,6 @@ 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))
|
||||
|
@ -50,6 +50,11 @@ public class GameScoreboard
|
||||
return _sideObjective;
|
||||
}
|
||||
|
||||
public String ParseTeamName(String name)
|
||||
{
|
||||
return name.substring(0, Math.min(16, name.length()));
|
||||
}
|
||||
|
||||
public void CreateTeams()
|
||||
{
|
||||
System.out.println("Creating Scoreboard Teams.");
|
||||
@ -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
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user