Merge branch 'master' of ssh://dev1.mineplex.com:7999/min/Mineplex
This commit is contained in:
commit
b1514fef5a
@ -8,6 +8,7 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.EntityEffect;
|
||||
import org.bukkit.FireworkEffect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
@ -45,12 +46,14 @@ 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.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.events.PlayerGameRespawnEvent;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.TeamGame;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
@ -62,6 +65,8 @@ import net.minecraft.server.v1_7_R3.Navigation;
|
||||
|
||||
public class CastleSiege extends TeamGame
|
||||
{
|
||||
private ArrayList<String> _lastScoreboard = new ArrayList<String>();
|
||||
|
||||
private long _tntSpawn = 0;
|
||||
private ArrayList<Location> _tntSpawns = new ArrayList<Location>();
|
||||
private ArrayList<Location> _tntWeakness = new ArrayList<Location>();
|
||||
@ -123,7 +128,7 @@ public class CastleSiege extends TeamGame
|
||||
this.WorldTimeSet = 14000; //14000
|
||||
this.BlockPlaceAllow.add(85);
|
||||
|
||||
_kingName = C.cYellow + C.Bold + "King Jonalon";
|
||||
_kingName = C.cYellow + C.Bold + "King Sparklez";
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -149,6 +154,8 @@ public class CastleSiege extends TeamGame
|
||||
{
|
||||
if (kit.GetName().contains("Castle"))
|
||||
team.GetRestrictedKits().add(kit);
|
||||
|
||||
team.SetName("Undead");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -156,6 +163,8 @@ public class CastleSiege extends TeamGame
|
||||
team.GetRestrictedKits().add(kit);
|
||||
|
||||
team.SetRespawnTime(8);
|
||||
|
||||
team.SetName("Defenders");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -307,11 +316,23 @@ public class CastleSiege extends TeamGame
|
||||
|
||||
if (team != null && team.GetColor() == ChatColor.RED)
|
||||
{
|
||||
if (!Recharge.Instance.use(damager, "Damage King", 400, false, false))
|
||||
return;
|
||||
|
||||
_king.playEffect(EntityEffect.HURT);
|
||||
|
||||
_kingDamager = damager;
|
||||
_kingHealth--;
|
||||
|
||||
if (_kingHealth < 0)
|
||||
_kingHealth = 0;
|
||||
|
||||
WriteScoreboard();
|
||||
|
||||
if (_kingHealth <= 0)
|
||||
_king.damage(500);
|
||||
|
||||
EndCheck();
|
||||
}
|
||||
}
|
||||
|
||||
@ -338,10 +359,10 @@ public class CastleSiege extends TeamGame
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void PlayerDeath(PlayerDeathEvent event)
|
||||
public void PlayerDeath(PlayerGameRespawnEvent event)
|
||||
{
|
||||
if (GetTeam(ChatColor.AQUA).HasPlayer(event.getEntity()))
|
||||
SetKit(event.getEntity(), GetKits()[3], true);
|
||||
if (GetTeam(ChatColor.AQUA).HasPlayer(event.GetPlayer()))
|
||||
SetKit(event.GetPlayer(), GetKits()[3], true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -351,16 +372,15 @@ public class CastleSiege extends TeamGame
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
//King
|
||||
if (_king != null && _king.isValid())
|
||||
{
|
||||
GetObjectiveSide().getScore(C.cYellow + C.Bold + "Kings Health").setScore(_kingHealth);
|
||||
WriteScoreboard();
|
||||
}
|
||||
|
||||
//Teams
|
||||
public void WriteScoreboard()
|
||||
{
|
||||
//Get Values
|
||||
HashMap<String, Integer> _scoreGroup = new HashMap<String, Integer>();
|
||||
_scoreGroup.put(C.cAqua + "Wolves", 0);
|
||||
_scoreGroup.put(C.cAqua + "Defenders", 0);
|
||||
_scoreGroup.put(C.cDAqua + "Wolves", 0);
|
||||
_scoreGroup.put(C.cRed + "Undead", 0);
|
||||
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
@ -375,7 +395,7 @@ public class CastleSiege extends TeamGame
|
||||
{
|
||||
if (kit.GetName().contains("Wolf"))
|
||||
{
|
||||
_scoreGroup.put(C.cAqua + "Wolves", 1 + _scoreGroup.get(C.cAqua + "Wolves"));
|
||||
_scoreGroup.put(C.cDAqua + "Wolves", 1 + _scoreGroup.get(C.cDAqua + "Wolves"));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -388,9 +408,82 @@ public class CastleSiege extends TeamGame
|
||||
}
|
||||
}
|
||||
|
||||
//Wipe Last
|
||||
for (String string : _lastScoreboard)
|
||||
GetScoreboard().resetScores(string);
|
||||
_lastScoreboard.clear();
|
||||
|
||||
int line = 1;
|
||||
String space = " ";
|
||||
|
||||
//Teams
|
||||
for (String group : _scoreGroup.keySet())
|
||||
{
|
||||
GetObjectiveSide().getScore(group).setScore(_scoreGroup.get(group));
|
||||
//Score
|
||||
String out = ChatColor.getLastColors(group) + _scoreGroup.get(group) + " Players";
|
||||
|
||||
if (out.length() >= 16)
|
||||
out = out.substring(0, 15);
|
||||
|
||||
_lastScoreboard.add(out);
|
||||
|
||||
GetObjectiveSide().getScore(out).setScore(line++);
|
||||
|
||||
//Team
|
||||
out = group;
|
||||
|
||||
if (out.length() >= 16)
|
||||
out = out.substring(0, 15);
|
||||
|
||||
_lastScoreboard.add(out);
|
||||
|
||||
GetObjectiveSide().getScore(out).setScore(line++);
|
||||
|
||||
//Space
|
||||
space += " ";
|
||||
out = space;
|
||||
|
||||
if (out.length() >= 16)
|
||||
out = out.substring(0, 15);
|
||||
|
||||
_lastScoreboard.add(out);
|
||||
|
||||
GetObjectiveSide().getScore(out).setScore(line++);
|
||||
}
|
||||
|
||||
//King
|
||||
if (_king != null && _king.isValid())
|
||||
{
|
||||
//Score
|
||||
String out = _kingHealth + " Health";
|
||||
|
||||
if (out.length() >= 16)
|
||||
out = out.substring(0, 15);
|
||||
|
||||
_lastScoreboard.add(out);
|
||||
|
||||
GetObjectiveSide().getScore(out).setScore(line++);
|
||||
|
||||
//Text
|
||||
out = C.cYellow + C.Bold + "King";
|
||||
|
||||
if (out.length() >= 16)
|
||||
out = out.substring(0, 15);
|
||||
|
||||
_lastScoreboard.add(out);
|
||||
|
||||
GetObjectiveSide().getScore(out).setScore(line++);
|
||||
|
||||
//Space
|
||||
space += " ";
|
||||
out = space;
|
||||
|
||||
if (out.length() >= 16)
|
||||
out = out.substring(0, 15);
|
||||
|
||||
_lastScoreboard.add(out);
|
||||
|
||||
GetObjectiveSide().getScore(out).setScore(line++);
|
||||
}
|
||||
}
|
||||
|
||||
@ -404,7 +497,6 @@ public class CastleSiege extends TeamGame
|
||||
{
|
||||
SetCustomWinLine(_kingName + ChatColor.RESET + " has survived the seige!");
|
||||
|
||||
SetState(GameState.End);
|
||||
AnnounceEnd(GetTeam(ChatColor.AQUA));
|
||||
|
||||
for (GameTeam team : GetTeamList())
|
||||
@ -421,6 +513,8 @@ public class CastleSiege extends TeamGame
|
||||
if (player.isOnline())
|
||||
AddGems(player, 10, "Participation", false);
|
||||
}
|
||||
|
||||
SetState(GameState.End);
|
||||
}
|
||||
|
||||
if (!_king.isValid())
|
||||
@ -433,7 +527,6 @@ public class CastleSiege extends TeamGame
|
||||
else
|
||||
SetCustomWinLine(_kingName + ChatColor.RESET + " has died!");
|
||||
|
||||
SetState(GameState.End);
|
||||
AnnounceEnd(GetTeam(ChatColor.RED));
|
||||
|
||||
for (GameTeam team : GetTeamList())
|
||||
@ -450,6 +543,8 @@ public class CastleSiege extends TeamGame
|
||||
if (player.isOnline())
|
||||
AddGems(player, 10, "Participation", false);
|
||||
}
|
||||
|
||||
SetState(GameState.End);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -717,7 +717,7 @@ public class GameFlagManager implements Listener
|
||||
((player.getLocation().getY() > game.WorldData.MaxY ||
|
||||
player.getLocation().getY() < game.WorldData.MinY) && game.IsAlive(player)))
|
||||
{
|
||||
if (!Manager.IsAlive(player))
|
||||
if (!Manager.IsAlive(player) || ((CraftPlayer)player).getHandle().spectating)
|
||||
{
|
||||
player.teleport(game.GetSpectatorLocation());
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -73,8 +74,16 @@ public class MiscManager implements Listener
|
||||
return;
|
||||
|
||||
Player player = UtilPlayer.searchExact(event.getWhoClicked().getName());
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
if (Manager.GetGame().IsLive() && !Manager.GetGame().IsAlive(player))
|
||||
if (player.getGameMode() != GameMode.SURVIVAL && !player.isOp())
|
||||
{
|
||||
event.setCancelled(true);
|
||||
player.closeInventory();
|
||||
}
|
||||
|
||||
else if (Manager.GetGame().IsLive() && !Manager.GetGame().IsAlive(player) && !((CraftPlayer)player).getHandle().spectating)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
player.closeInventory();
|
||||
|
Loading…
Reference in New Issue
Block a user