Animation

This commit is contained in:
Mysticate 2015-10-09 22:14:01 -04:00
parent ff1431b652
commit 90c685617d
2 changed files with 133 additions and 40 deletions

View File

@ -28,6 +28,23 @@ public class C
public static String cWhite = "" + ChatColor.WHITE; public static String cWhite = "" + ChatColor.WHITE;
public static String cYellow = "" + ChatColor.YELLOW; public static String cYellow = "" + ChatColor.YELLOW;
public static String cAquaB = "" + ChatColor.AQUA + "" + ChatColor.BOLD;
public static String cBlackB = "" + ChatColor.BLACK + "" + ChatColor.BOLD;
public static String cBlueB = "" + ChatColor.BLUE + "" + ChatColor.BOLD;
public static String cDAquaB = "" + ChatColor.DARK_AQUA + "" + ChatColor.BOLD;
public static String cDBlueB = "" + ChatColor.DARK_BLUE + "" + ChatColor.BOLD;
public static String cDGrayB = "" + ChatColor.DARK_GRAY + "" + ChatColor.BOLD;
public static String cDGreenB = "" + ChatColor.DARK_GREEN + "" + ChatColor.BOLD;
public static String cDPurpleB = "" + ChatColor.DARK_PURPLE + "" + ChatColor.BOLD;
public static String cDRedB = "" + ChatColor.DARK_RED + "" + ChatColor.BOLD;
public static String cGoldB = "" + ChatColor.GOLD + "" + ChatColor.BOLD;
public static String cGrayB = "" + ChatColor.GRAY + "" + ChatColor.BOLD;
public static String cGreenB = "" + ChatColor.GREEN + "" + ChatColor.BOLD;
public static String cPurpleB = "" + ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD;
public static String cRedB = "" + ChatColor.RED + "" + ChatColor.BOLD;
public static String cWhiteB = "" + ChatColor.WHITE + "" + ChatColor.BOLD;
public static String cYellowB = "" + ChatColor.YELLOW + "" + ChatColor.BOLD;
public static String mHead = "" + ChatColor.BLUE; public static String mHead = "" + ChatColor.BLUE;
public static String mBody = "" + ChatColor.GRAY; public static String mBody = "" + ChatColor.GRAY;
public static String mChat = "" + ChatColor.WHITE; public static String mChat = "" + ChatColor.WHITE;

View File

@ -3,14 +3,6 @@ package mineplex.hub.modules;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Creature;
import org.bukkit.entity.Player;
import org.bukkit.entity.Wither;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerJoinEvent;
import mineplex.core.MiniPlugin; import mineplex.core.MiniPlugin;
import mineplex.core.common.Rank; import mineplex.core.common.Rank;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
@ -18,9 +10,9 @@ import mineplex.core.common.util.Callback;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
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.UtilTextMiddle;
import mineplex.core.common.util.UtilTextTop; import mineplex.core.common.util.UtilTextTop;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.gadget.gadgets.MorphWither; import mineplex.core.gadget.gadgets.MorphWither;
import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.Gadget;
import mineplex.core.gadget.types.GadgetType; import mineplex.core.gadget.types.GadgetType;
@ -30,6 +22,15 @@ import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.hub.HubManager; import mineplex.hub.HubManager;
import mineplex.hub.HubRepository; import mineplex.hub.HubRepository;
import mineplex.hub.HubType;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Creature;
import org.bukkit.entity.Player;
import org.bukkit.entity.Wither;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerJoinEvent;
public class NewsManager extends MiniPlugin public class NewsManager extends MiniPlugin
{ {
@ -39,7 +40,7 @@ public class NewsManager extends MiniPlugin
private int _newsIndex = 0; private int _newsIndex = 0;
private long _newsTime = System.currentTimeMillis(); private long _newsTime = System.currentTimeMillis();
private int _mineplexIndex = 0; private int _animationIndex = 0;
private HubRepository _repository = new HubRepository(); private HubRepository _repository = new HubRepository();
@ -228,30 +229,123 @@ public class NewsManager extends MiniPlugin
RefreshNews(); RefreshNews();
} }
@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()
{
UtilTextMiddle.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));
}
}
@EventHandler @EventHandler
public void DragonBarUpdate(UpdateEvent event) public void DragonBarUpdate(UpdateEvent event)
{ {
if (event.getType() != UpdateType.FASTEST) if (event.getType() != UpdateType.FASTEST)
return; return;
_mineplexIndex = (_mineplexIndex + 1)%6; String text = "";
double healthPercent = 1;
//News Change if (Manager.Type == HubType.Halloween)
if (UtilTime.elapsed(_newsTime, 4500))
{ {
_newsIndex = (_newsIndex + 1)%_news.length; _animationIndex = (_animationIndex + 1) % 100;
_newsTime = System.currentTimeMillis();
}
if (_newsIndex >= _news.length)
{
// Resets newsIndex if outside of bounds of news array after RefreshNews but before UtilTime.elapsed above
_newsIndex = 0;
}
double healthPercent = (double)_newsIndex/(double)(_news.length-1); if (_animationIndex < 24)
String text = _news[_newsIndex]; {
//Start up
if (_animationIndex == 0 || _animationIndex == 1) text = C.cGoldB + "M";
if (_animationIndex == 2 || _animationIndex == 3) text = C.cGoldB + "MI";
if (_animationIndex == 4 || _animationIndex == 5) text = C.cGoldB + "MINE";
if (_animationIndex == 6 || _animationIndex == 7) text = C.cGoldB + "MINEP";
if (_animationIndex == 8 || _animationIndex == 9) text = C.cGoldB + "MINEPL";
if (_animationIndex == 10 || _animationIndex == 11) text = C.cGoldB + "MINEPLE";
if (_animationIndex >= 12) text = C.cGoldB + "MINEPLEX";
}
if (_animationIndex >= 20 && _animationIndex < 50)
{
//Happy halloween
if (_animationIndex == 20) text = C.cWhiteB + C.Scramble + "2 " + C.cGoldB + " MINEPLEX " + C.cWhiteB + C.Scramble + " 5";
if (_animationIndex == 21) text = C.cWhiteB + C.Scramble + "20 " + C.cGoldB + " MINEPLEX " + C.cWhiteB + C.Scramble + " 15";
if (_animationIndex == 22) text = C.cWhiteB + C.Scramble + "201 " + C.cGoldB + " MINEPLEX " + C.cWhiteB + C.Scramble + " 015";
if (_animationIndex == 23) text = C.cWhiteB + C.Scramble + "2015" + C.cGoldB + " MINEPLEX " + C.cWhiteB + C.Scramble + "2015";
if (_animationIndex == 24) text = C.cWhiteB + C.Scramble + "2015" + C.cGoldB + " MIN" + C.Scramble + "EP" + C.cGoldB + "LEX " + C.cWhiteB + C.Scramble + "2015";
if (_animationIndex == 25) text = C.cWhiteB + C.Scramble + "2015" + C.cGoldB + " MI" + C.Scramble + "NEPL" + C.cGoldB + "EX " + C.cWhiteB + C.Scramble + "2015";
if (_animationIndex == 26) text = C.cWhiteB + C.Scramble + "2015" + C.cGoldB + " M" + C.Scramble + "INEPLE" + C.cGoldB + "X " + C.cWhiteB + C.Scramble + "2015";
if (_animationIndex == 27) text = C.cWhiteB + C.Scramble + "2015" + C.cGoldB + " " + C.Scramble + "MINEPLEX" + C.cGoldB + " " + C.cWhiteB + C.Scramble + "2015";
if (_animationIndex == 28) text = C.cWhiteB + C.Scramble + "2015" + C.cGoldB + " " + C.Scramble + "HAPPY_HAL" + C.cGoldB + " " + C.cWhiteB + C.Scramble + "2015";
if (_animationIndex == 29) text = C.cWhiteB + C.Scramble + "2015" + C.cGoldB + " " + C.Scramble + "HAPPY_HALL" + C.cGoldB + " " + C.cWhiteB + C.Scramble + "2015";
if (_animationIndex == 30) text = C.cWhiteB + C.Scramble + "2015" + C.cGoldB + " " + C.Scramble + "HAPPY_HALLO" + C.cGoldB + " " + C.cWhiteB + C.Scramble + "2015";
if (_animationIndex == 31) text = C.cWhiteB + C.Scramble + "2015" + C.cGoldB + " " + C.Scramble + "HAPPY_HALLOW" + C.cGoldB + " " + C.cWhiteB + C.Scramble + "2015";
if (_animationIndex == 32) text = C.cWhiteB + C.Scramble + "2015" + C.cGoldB + " " + C.Scramble + "HAPPY_HALLOWE" + C.cGoldB + " " + C.cWhiteB + C.Scramble + "2015";
if (_animationIndex == 33) text = C.cWhiteB + C.Scramble + "2015" + C.cGoldB + " " + C.Scramble + "HAPPY_HALLOWEE" + C.cGoldB + " " + C.cWhiteB + C.Scramble + "2015";
if (_animationIndex == 34) text = C.cWhiteB + C.Scramble + "2015" + C.cGoldB + " " + C.Scramble + "HAPPY_HALLOWEEN" + C.cGoldB + " " + C.cWhiteB + C.Scramble + "2015";
if (_animationIndex > 34)
{
if (_animationIndex % 3 == 0) text = C.cWhiteB + "2015" + C.cGoldB + " HAPPY HALLOWEEN " + C.cWhiteB + "2015";
else if (_animationIndex % 3 == 1) text = C.cWhiteB + "2015" + C.cRedB + " HAPPY HALLOWEEN " + C.cWhiteB + "2015";
else text = C.cWhiteB + "2015" + C.cYellowB + " HAPPY HALLOWEEN " + C.cWhiteB + "2015";
}
}
//Halloween horror
if (_animationIndex >= 50 && _animationIndex < 66)
{
if (_animationIndex % 2 == 0) text = C.cWhiteB + "Event" + C.cGoldB + " HALLOWEEN HORROR " + C.cWhiteB + "Event";
else if (_animationIndex % 2 == 1) text = C.cWhiteB + "Event" + C.cRedB + " HALLOWEEN HORROR " + C.cWhiteB + "Event";
else text = C.cWhiteB + "Event" + C.cYellowB + " HALLOWEEN HORROR " + C.cWhiteB + "Event";
}
//Spider Mount
if (_animationIndex >= 66 && _animationIndex < 82)
{
if (_animationIndex % 2 == 0) text = C.cWhiteB + "Limited Time" + C.cGoldB + " SPIDER MOUNT " + C.cWhiteB + "Limited Time";
else if (_animationIndex % 2 == 1) text = C.cWhiteB + "Limited Time" + C.cRedB + " SPIDER MOUNT " + C.cWhiteB + "Limited Time";
else text = C.cWhiteB + "Limited Time" + C.cYellowB + " SPIDER MOUNT " + C.cWhiteB + "Limited Time";
}
//Sale
if (_animationIndex >= 82 && _animationIndex <= 100)
{
if (_animationIndex % 2 == 0) text = C.cWhiteB + "50% Off" + C.cGoldB + " SPOOKY SALE " + C.cWhiteB + "50% Off";
else if (_animationIndex % 2 == 1) text = C.cWhiteB + "50% Off" + C.cRedB + " SPOOKY SALE " + C.cWhiteB + "50% Off";
else text = C.cWhiteB + "50% Off" + C.cYellowB + " SPOOKY SALE " + C.cWhiteB + "50% Off";
}
}
else
{
//News Change
if (UtilTime.elapsed(_newsTime, 4500))
{
_newsIndex = (_newsIndex + 1)%_news.length;
_newsTime = System.currentTimeMillis();
}
if (_newsIndex >= _news.length)
{
// Resets newsIndex if outside of bounds of news array after RefreshNews but before UtilTime.elapsed above
_newsIndex = 0;
}
healthPercent = (double)_newsIndex/(double)(_news.length-1);
text = _news[_newsIndex];
}
UtilTextTop.display(text, UtilServer.getPlayers()); UtilTextTop.display(text, UtilServer.getPlayers());
//Fix Entity Names
for (Creature pet : Manager.getPetManager().getPets()) for (Creature pet : Manager.getPetManager().getPets())
{ {
if (pet instanceof Wither) if (pet instanceof Wither)
@ -277,22 +371,4 @@ 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()
{
UtilTextMiddle.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));
}
}
} }