Merge remote-tracking branch 'origin/master'

This commit is contained in:
Shaun Bennett 2014-09-14 00:29:37 -05:00
commit 8659422877
8 changed files with 99 additions and 21 deletions

View File

@ -13,13 +13,44 @@ import org.spigotmc.ProtocolInjector.PacketTitle.Action;
*/ */
public class UtilTitle public class UtilTitle
{ {
public static void display(String text, String subtitle, Player... players)
{
setSubtitle(subtitle, players);
showTitle(text, players);
}
public static void display(String text, String subtitle)
{
setSubtitle(subtitle, UtilServer.getPlayers());
showTitle(text, UtilServer.getPlayers());
}
public static void display(String text, String subtitle, int fadeInTicks, int stayTicks, int fadeOutTicks, Player... players)
{
setTimings(fadeInTicks, stayTicks, fadeOutTicks, players);
display(text, subtitle, players);
}
public static void display(String text, String subtitle, int fadeInTicks, int stayTicks, int fadeOutTicks)
{
setTimings(fadeInTicks, stayTicks, fadeOutTicks, UtilServer.getPlayers());
display(text, subtitle, UtilServer.getPlayers());
}
/** /**
* Show Title text for a player with their current set timings. * Show Title text for a player with their current set timings.
* *
* Default timings are 20, 60, 20 (in ticks) * Default timings are 20, 60, 20 (in ticks)
*/ */
public static void showTitle(String text, Player... players) private static void showTitle(String text, Player... players)
{ {
if (text == null)
text = "";
ChatMessage message = new ChatMessage(text); ChatMessage message = new ChatMessage(text);
PacketTitle packet = new PacketTitle(Action.TITLE, message); PacketTitle packet = new PacketTitle(Action.TITLE, message);
sendPacket(packet, players); sendPacket(packet, players);
@ -30,8 +61,11 @@ public class UtilTitle
* *
* This stays unless reset or cleared, and doesn't appear unless a title is showing * This stays unless reset or cleared, and doesn't appear unless a title is showing
*/ */
public static void setSubtitle(String text, Player... players) private static void setSubtitle(String text, Player... players)
{ {
if (text == null)
text = "";
ChatMessage message = new ChatMessage(text); ChatMessage message = new ChatMessage(text);
PacketTitle packet = new PacketTitle(Action.SUBTITLE, message); PacketTitle packet = new PacketTitle(Action.SUBTITLE, message);
sendPacket(packet, players); sendPacket(packet, players);
@ -42,7 +76,7 @@ public class UtilTitle
* *
* Remember these are in ticks * Remember these are in ticks
*/ */
public static void setTimings(int fadeInTicks, int stayTicks, int fadeOutTicks, Player... players) private static void setTimings(int fadeInTicks, int stayTicks, int fadeOutTicks, Player... players)
{ {
PacketTitle packet = new PacketTitle(Action.TIMES, fadeInTicks, stayTicks, fadeOutTicks); PacketTitle packet = new PacketTitle(Action.TIMES, fadeInTicks, stayTicks, fadeOutTicks);
sendPacket(packet, players); sendPacket(packet, players);

View File

@ -53,6 +53,7 @@ import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilTitle;
import mineplex.core.common.util.UtilWorld; import mineplex.core.common.util.UtilWorld;
import mineplex.core.treasure.TreasureManager; import mineplex.core.treasure.TreasureManager;
import mineplex.minecraft.game.core.condition.ConditionManager; import mineplex.minecraft.game.core.condition.ConditionManager;
@ -945,6 +946,4 @@ public class HubManager extends MiniClientPlugin<HubClient>
{ {
} }
} }

View File

@ -7,6 +7,8 @@ import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.server.ServerListPingEvent;
import mineplex.core.MiniPlugin; import mineplex.core.MiniPlugin;
import mineplex.core.common.Rank; import mineplex.core.common.Rank;
@ -17,6 +19,7 @@ import mineplex.core.common.util.UtilDisplay;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilTitle;
import mineplex.core.mount.Mount; import mineplex.core.mount.Mount;
import mineplex.core.mount.types.MountDragon; import mineplex.core.mount.types.MountDragon;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
@ -46,8 +49,10 @@ public class NewsManager extends MiniPlugin
_news = new String[] _news = new String[]
{ {
"Champions: " + C.cYellow + C.Bold + "Team Deathmatch Beta", "News Line 1",
"Survival: " + C.cGreen + C.Bold + "UHC Alpha", "News Line 2",
"News Line 3",
"News Line 4",
}; };
RefreshNews(); RefreshNews();
@ -216,7 +221,7 @@ public class NewsManager extends MiniPlugin
} }
@EventHandler @EventHandler
public void FlightUpdate(UpdateEvent event) public void DragonBarUpdate(UpdateEvent event)
{ {
if (event.getType() != UpdateType.FASTEST) if (event.getType() != UpdateType.FASTEST)
return; return;
@ -260,4 +265,22 @@ public class NewsManager extends MiniPlugin
} }
} }
} }
@EventHandler
public void joinNewsOverlay(final PlayerJoinEvent event)
{
for (int i=0 ; i<_news.length ; i++)
{
final int count = i;
UtilServer.getServer().getScheduler().runTaskLater(Manager.GetPlugin(), new Runnable()
{
@Override
public void run()
{
UtilTitle.display(C.cGold + C.Bold + "MINEPLEX" + ChatColor.RESET, _news[_news.length - 1 - count] + ChatColor.RESET, (count == 0) ? 20 : 0, 60, 20, event.getPlayer());
}
}, 60 * i + (i != 0 ? 20 : 0));
}
}
} }

View File

@ -902,6 +902,8 @@ public abstract class Game implements Listener
if (!IsLive()) if (!IsLive())
return; return;
String winnerText = ChatColor.WHITE + "§lNobody won the game...";
for (Player player : UtilServer.getPlayers()) for (Player player : UtilServer.getPlayers())
{ {
player.playSound(player.getLocation(), Sound.LEVEL_UP, 2f, 1f); player.playSound(player.getLocation(), Sound.LEVEL_UP, 2f, 1f);
@ -917,11 +919,13 @@ public abstract class Game implements Listener
{ {
WinnerTeam = team; WinnerTeam = team;
Winner = team.GetName() + " Team"; Winner = team.GetName() + " Team";
UtilPlayer.message(player, team.GetColor() + C.Bold + team.GetName() + " won the game!");
winnerText = team.GetColor() + C.Bold + team.GetName() + " won the game!";
UtilPlayer.message(player, winnerText);
} }
else else
{ {
UtilPlayer.message(player, ChatColor.WHITE + "§lNobody won the game..."); UtilPlayer.message(player, winnerText);
} }
@ -932,12 +936,16 @@ public abstract class Game implements Listener
UtilPlayer.message(player, ArcadeFormat.Line); UtilPlayer.message(player, ArcadeFormat.Line);
} }
UtilTitle.display(winnerText, _customWinLine, 20, 120, 20);
if (AnnounceSilence) if (AnnounceSilence)
Manager.GetChat().Silence(5000, false); Manager.GetChat().Silence(5000, false);
} }
public void AnnounceEnd(List<Player> places) public void AnnounceEnd(List<Player> places)
{ {
String winnerText = ChatColor.WHITE + "§lNobody won the game...";
for (Player player : UtilServer.getPlayers()) for (Player player : UtilServer.getPlayers())
{ {
player.playSound(player.getLocation(), Sound.LEVEL_UP, 2f, 1f); player.playSound(player.getLocation(), Sound.LEVEL_UP, 2f, 1f);
@ -959,16 +967,24 @@ public abstract class Game implements Listener
if (places.size() >= 1) if (places.size() >= 1)
{ {
Winner = places.get(0).getName(); Winner = places.get(0).getName();
winnerText = C.cYellow + C.Bold + places.get(0).getName() + " won the game!";
UtilPlayer.message(player, C.cRed + C.Bold + "1st Place" + C.cWhite + " - " + places.get(0).getName()); UtilPlayer.message(player, C.cRed + C.Bold + "1st Place" + C.cWhite + " - " + places.get(0).getName());
} }
if (places.size() >= 2) if (places.size() >= 2)
{
UtilPlayer.message(player, C.cGold + C.Bold + "2nd Place" + C.cWhite + " - " + places.get(1).getName()); UtilPlayer.message(player, C.cGold + C.Bold + "2nd Place" + C.cWhite + " - " + places.get(1).getName());
}
if (places.size() >= 3) if (places.size() >= 3)
{
UtilPlayer.message(player, C.cYellow + C.Bold + "3rd Place" + C.cWhite + " - " + places.get(2).getName()); UtilPlayer.message(player, C.cYellow + C.Bold + "3rd Place" + C.cWhite + " - " + places.get(2).getName());
} }
}
UtilPlayer.message(player, ""); UtilPlayer.message(player, "");
UtilPlayer.message(player, "§aMap - §f§l" + WorldData.MapName + C.cGray + " created by " + "§f§l" + WorldData.MapAuthor); UtilPlayer.message(player, "§aMap - §f§l" + WorldData.MapName + C.cGray + " created by " + "§f§l" + WorldData.MapAuthor);
@ -976,6 +992,8 @@ public abstract class Game implements Listener
UtilPlayer.message(player, ArcadeFormat.Line); UtilPlayer.message(player, ArcadeFormat.Line);
} }
UtilTitle.display(winnerText, null, 20, 120, 20);
if (AnnounceSilence) if (AnnounceSilence)
Manager.GetChat().Silence(5000, false); Manager.GetChat().Silence(5000, false);
} }

View File

@ -8,6 +8,7 @@ import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilTitle;
import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.common.Domination; import nautilus.game.arcade.game.games.common.Domination;

View File

@ -62,6 +62,7 @@ import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTitle;
import mineplex.core.common.util.UtilWorld; import mineplex.core.common.util.UtilWorld;
import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ParticleType;
@ -1721,6 +1722,8 @@ public class MineStrike extends TeamGame
for (Player player : UtilServer.getPlayers()) for (Player player : UtilServer.getPlayers())
player.playSound(player.getLocation(), Sound.LEVEL_UP, 1f, 1f); player.playSound(player.getLocation(), Sound.LEVEL_UP, 1f, 1f);
UtilTitle.display(winnerLine, _winText, 20, 120, 20);
//Check for total game win //Check for total game win
EndCheck(); EndCheck();

View File

@ -90,7 +90,7 @@ public class Quiver extends SoloGame
for (Player player : GetPlayers(true)) for (Player player : GetPlayers(true))
{ {
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte)1, 1, F.item("Super Arrow"))); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte)0, 1, F.item("Super Arrow")));
player.playSound(player.getLocation(), Sound.PISTON_EXTEND, 3f, 2f); player.playSound(player.getLocation(), Sound.PISTON_EXTEND, 3f, 2f);
} }
} }
@ -124,7 +124,7 @@ public class Quiver extends SoloGame
public void run() public void run()
{ {
if (!player.getInventory().contains(Material.ARROW)) if (!player.getInventory().contains(Material.ARROW))
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte)1, 1, F.item("Super Arrow"))); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte)0, 1, F.item("Super Arrow")));
} }
}, 10); }, 10);
@ -148,7 +148,7 @@ public class Quiver extends SoloGame
if (player == null) return; if (player == null) return;
//New Arrow //New Arrow
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte)1, 1, F.item("Super Arrow"))); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte)0, 1, F.item("Super Arrow")));
player.playSound(player.getLocation(), Sound.PISTON_EXTEND, 3f, 2f); player.playSound(player.getLocation(), Sound.PISTON_EXTEND, 3f, 2f);
//Score //Score

View File

@ -261,14 +261,14 @@ public class GameFlagManager implements Listener
} }
if (!game.InventoryOpenChest) // if (!game.InventoryOpenChest)
{ // {
if (event.getInventory().getType() == InventoryType.CHEST) // if (event.getInventory().getType() == InventoryType.CHEST)
{ // {
event.setCancelled(true); // event.setCancelled(true);
event.getPlayer().closeInventory(); // event.getPlayer().closeInventory();
} // }
} // }
} }
@EventHandler(priority = EventPriority.LOWEST) @EventHandler(priority = EventPriority.LOWEST)