From b6ba142c5aef70fa8814296238968b3690d64001 Mon Sep 17 00:00:00 2001 From: Chiss Date: Thu, 14 Aug 2014 11:23:48 +1000 Subject: [PATCH] Mineplex in scoreboard is fancier. --- Plugins/Mineplex.Core.Common/.classpath | 2 +- .../core/common/util/UtilDisplay.java | 4 +- Plugins/Nautilus.Core.CraftBukkit/.classpath | 2 +- .../game/arcade/managers/GameManager.java | 12 +++++ .../arcade/scoreboard/GameScoreboard.java | 50 ++++++++++++++++++- 5 files changed, 63 insertions(+), 7 deletions(-) diff --git a/Plugins/Mineplex.Core.Common/.classpath b/Plugins/Mineplex.Core.Common/.classpath index f81250dfa..b19944b54 100644 --- a/Plugins/Mineplex.Core.Common/.classpath +++ b/Plugins/Mineplex.Core.Common/.classpath @@ -2,6 +2,6 @@ - + diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilDisplay.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilDisplay.java index 5917b417d..a361633a4 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilDisplay.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilDisplay.java @@ -7,12 +7,10 @@ import net.minecraft.server.v1_7_R4.DataWatcher; import net.minecraft.server.v1_7_R4.EntityPlayer; import net.minecraft.server.v1_7_R4.MathHelper; import net.minecraft.server.v1_7_R4.Packet; -import net.minecraft.server.v1_7_R4.PacketPlayInClientCommand; import net.minecraft.server.v1_7_R4.PacketPlayOutEntityDestroy; import net.minecraft.server.v1_7_R4.PacketPlayOutEntityMetadata; import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntityLiving; -import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; import org.bukkit.entity.EntityType; @@ -29,7 +27,7 @@ public class UtilDisplay public static void sendPacket(Player player, Packet packet){ EntityPlayer entityPlayer = ((CraftPlayer) player).getHandle(); - entityPlayer.playerConnection.sendPacket(packet); + entityPlayer.playerConnection.sendPacket(packet); } //Accessing packets diff --git a/Plugins/Nautilus.Core.CraftBukkit/.classpath b/Plugins/Nautilus.Core.CraftBukkit/.classpath index d5f3f80ed..695c3e82e 100644 --- a/Plugins/Nautilus.Core.CraftBukkit/.classpath +++ b/Plugins/Nautilus.Core.CraftBukkit/.classpath @@ -3,6 +3,6 @@ - + diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java index f0d4ae9e7..605e3956d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java @@ -285,6 +285,18 @@ public class GameManager implements Listener } } } + + @EventHandler + public void ScoreboardTitle(UpdateEvent event) + { + if (event.getType() != UpdateType.FASTEST) + return; + + Game game = Manager.GetGame(); + if (game == null) return; + + game.GetScoreboard().UpdateTitle(); + } @EventHandler(priority = EventPriority.LOWEST) //BEFORE PARSE DATA public void TeamGeneration(GameStateChangeEvent event) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/scoreboard/GameScoreboard.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/scoreboard/GameScoreboard.java index 015614ba7..64b44b6c3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/scoreboard/GameScoreboard.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/scoreboard/GameScoreboard.java @@ -30,9 +30,11 @@ public class GameScoreboard private String[] _current = new String[15]; private String _title; + private int _shineIndex; + private boolean _shineDirection = true; private boolean _debug = false; - + public GameScoreboard(Game game) { Game = game; @@ -59,7 +61,51 @@ public class GameScoreboard public void UpdateTitle() { - + String out; + + if (_shineDirection) + { + out = C.cGold + C.Bold; + } + else + { + out = C.cWhite + C.Bold; + } + + for (int i=0 ; i < _title.length() ; i++) + { + char c = _title.charAt(i); + + if (_shineDirection) + { + if (i == _shineIndex) + out += C.cYellow + C.Bold; + + if (i == _shineIndex + 1) + out += C.cWhite + C.Bold; + } + else + { + if (i == _shineIndex) + out += C.cYellow + C.Bold; + + if (i == _shineIndex + 1) + out += C.cGold + C.Bold; + } + + + out += c; + } + + _sideObjective.setDisplayName(out); + + _shineIndex++; + + if (_shineIndex == _title.length()*2) + { + _shineIndex = 0; + _shineDirection = !_shineDirection; + } } public String ParseTeamName(String name)