Mineplex2018-withcommit/Plugins/Mineplex.Hub/src/mineplex/hub/modules/TextManager.java

157 lines
6.1 KiB
Java
Raw Normal View History

2013-09-18 11:46:45 +02:00
package mineplex.hub.modules;
2013-08-27 17:14:08 +02:00
import mineplex.core.MiniPlugin;
2013-08-27 17:14:08 +02:00
import mineplex.core.common.util.UtilText;
import mineplex.core.common.util.UtilText.TextAlign;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
2013-09-18 11:46:45 +02:00
import mineplex.hub.HubManager;
2013-08-27 17:14:08 +02:00
import org.bukkit.Location;
import org.bukkit.block.BlockFace;
import org.bukkit.event.EventHandler;
2013-08-27 17:14:08 +02:00
2013-09-18 11:46:45 +02:00
public class TextManager extends MiniPlugin
2013-08-27 17:14:08 +02:00
{
public HubManager Manager;
2013-09-03 02:16:44 +02:00
public Location locComp;
public Location locArcade;
public Location locSurvival;
public Location locClassics;
2013-08-27 17:14:08 +02:00
BlockFace faceComp = BlockFace.SOUTH;
BlockFace faceArcade = BlockFace.WEST;
BlockFace faceSurvival = BlockFace.NORTH;
BlockFace faceOther = BlockFace.EAST;
String[] arcadeGames;
int arcadeIndex = 0;
int smashIndex = 0;
2013-09-18 11:46:45 +02:00
public TextManager(HubManager manager)
2013-08-27 17:14:08 +02:00
{
super("Text Creator", manager.GetPlugin());
2013-08-27 17:14:08 +02:00
Manager = manager;
locComp = manager.GetSpawn().add(40, 10, 0);
locArcade = manager.GetSpawn().add(0, 10, 40);
locSurvival = manager.GetSpawn().add(-40, 10, 0);
2013-09-03 02:16:44 +02:00
locClassics = manager.GetSpawn().add(0, 10, -40);
2013-08-27 17:14:08 +02:00
arcadeGames = new String[]
{
"A BARBARIANS LIFE",
"ONE IN THE QUIVER",
"DRAGON ESCAPE",
"MILK THE COW",
"SUPER SPLEEF",
"DEATH TAG",
2013-09-18 11:46:45 +02:00
"TURF WARS",
"DRAGONS",
"RUNNER",
"BACON BRAWL",
"SQUID SAUCE"
};
2013-08-27 17:14:08 +02:00
CreateText();
}
public void CreateText()
{
//Comp
UtilText.MakeText("CHAMPIONS", locComp, faceComp, 159, (byte)5, TextAlign.CENTER);
2013-11-16 11:21:04 +01:00
UtilText.MakeText("CHAMPIONS", locComp.clone().add(1, 0, 0), faceComp, 159, (byte)15, TextAlign.CENTER);
2013-08-27 17:14:08 +02:00
UtilText.MakeText("DOMINATE", locComp.clone().add(15, 14, 0), faceComp, 159, (byte)4, TextAlign.CENTER);
2013-11-16 11:21:04 +01:00
UtilText.MakeText("DOMINATE", locComp.clone().add(16, 14, 0), faceComp, 159, (byte)15, TextAlign.CENTER);
2013-08-27 17:14:08 +02:00
2013-08-31 10:57:33 +02:00
UtilText.MakeText("DEATHMATCH", locComp.clone().add(15, 21, 0), faceComp, 159, (byte)1, TextAlign.CENTER);
2013-11-16 11:21:04 +01:00
UtilText.MakeText("DEATHMATCH", locComp.clone().add(16, 21, 0), faceComp, 159, (byte)15, TextAlign.CENTER);
2013-08-27 17:14:08 +02:00
2013-08-31 10:57:33 +02:00
UtilText.MakeText("CAPTURE THE PIG", locComp.clone().add(15, 28, 0), faceComp, 159, (byte)14, TextAlign.CENTER);
2013-11-16 11:21:04 +01:00
UtilText.MakeText("CAPTURE THE PIG", locComp.clone().add(16, 28, 0), faceComp, 159, (byte)15, TextAlign.CENTER);
2013-08-27 17:14:08 +02:00
//Arcade
UtilText.MakeText("ARCADE", locArcade, faceArcade, 159, (byte)5, TextAlign.CENTER);
2013-11-16 11:21:04 +01:00
UtilText.MakeText("ARCADE", locArcade.clone().add(0, 0, 1), faceArcade, 159, (byte)15, TextAlign.CENTER);
2013-08-27 17:14:08 +02:00
//Survival
2013-08-31 13:31:09 +02:00
UtilText.MakeText("SURVIVAL", locSurvival, faceSurvival, 159, (byte)5, TextAlign.CENTER);
2013-11-16 11:21:04 +01:00
UtilText.MakeText("SURVIVAL", locSurvival.clone().add(-1, 0, 0), faceSurvival, 159, (byte)15, TextAlign.CENTER);
2013-08-27 17:14:08 +02:00
UtilText.MakeText("THE BRIDGES", locSurvival.clone().add(-15, 14, 0), faceSurvival, 159, (byte)4, TextAlign.CENTER);
2013-11-16 11:21:04 +01:00
UtilText.MakeText("THE BRIDGES", locSurvival.clone().add(-16, 14, 0), faceSurvival, 159, (byte)15, TextAlign.CENTER);
2013-11-23 10:55:01 +01:00
2013-09-18 11:46:45 +02:00
UtilText.MakeText("SURVIVAL GAMES", locSurvival.clone().add(-15, 21, 0), faceSurvival, 159, (byte)1, TextAlign.CENTER);
2013-11-16 11:21:04 +01:00
UtilText.MakeText("SURVIVAL GAMES", locSurvival.clone().add(-16, 21, 0), faceSurvival, 159, (byte)15, TextAlign.CENTER);
2013-11-23 10:55:01 +01:00
2013-08-27 17:14:08 +02:00
//Other
2013-09-03 02:16:44 +02:00
UtilText.MakeText("CLASSICS", locClassics, faceOther, 159, (byte)5, TextAlign.CENTER);
2013-11-16 11:21:04 +01:00
UtilText.MakeText("CLASSICS", locClassics.add(0, 0, -1), faceOther, 159, (byte)15, TextAlign.CENTER);
2013-08-27 17:14:08 +02:00
2013-09-03 02:16:44 +02:00
UtilText.MakeText("SUPER SMASH MOBS", locClassics.clone().add(0, 14, -15), faceOther, 159, (byte)4, TextAlign.CENTER);
2013-11-16 11:21:04 +01:00
UtilText.MakeText("SUPER SMASH MOBS", locClassics.clone().add(0, 14, -16), faceOther, 159, (byte)15, TextAlign.CENTER);
2013-11-16 11:21:04 +01:00
UtilText.MakeText("BLOCK HUNT", locClassics.clone().add(0, 21, -15), faceOther, 159, (byte)1, TextAlign.CENTER);
UtilText.MakeText("BLOCK HUNT", locClassics.clone().add(0, 21, -16), faceOther, 159, (byte)15, TextAlign.CENTER);
UtilText.MakeText("MINEKART", locClassics.clone().add(0, 28, -15), faceOther, 159, (byte)14, TextAlign.CENTER);
UtilText.MakeText("MINEKART", locClassics.clone().add(0, 28, -16), faceOther, 159, (byte)15, TextAlign.CENTER);
}
@EventHandler
public void UpdateArcadeGames(UpdateEvent event)
{
if (event.getType() != UpdateType.SLOW)
return;
UtilText.MakeText(GetArcadeText(0), locArcade.clone().add(0, 14, 15), faceArcade, 159, (byte)4, TextAlign.CENTER);
2013-11-16 11:21:04 +01:00
UtilText.MakeText(GetArcadeText(0), locArcade.clone().add(0, 14, 16), faceArcade, 159, (byte)15, TextAlign.CENTER);
UtilText.MakeText(GetArcadeText(1), locArcade.clone().add(0, 21, 15), faceArcade, 159, (byte)1, TextAlign.CENTER);
2013-11-16 11:21:04 +01:00
UtilText.MakeText(GetArcadeText(1), locArcade.clone().add(0, 21, 16), faceArcade, 159, (byte)15, TextAlign.CENTER);
UtilText.MakeText(GetArcadeText(2), locArcade.clone().add(0, 28, 15), faceArcade, 159, (byte)14, TextAlign.CENTER);
2013-11-16 11:21:04 +01:00
UtilText.MakeText(GetArcadeText(2), locArcade.clone().add(0, 28, 16), faceArcade, 159, (byte)15, TextAlign.CENTER);
arcadeIndex = (arcadeIndex + 3)%arcadeGames.length;
}
public String GetArcadeText(int offset)
{
int index = (arcadeIndex + offset)%arcadeGames.length;
return arcadeGames[index];
}
/*
@EventHandler
public void UpdateNew(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
return;
long startTime = System.currentTimeMillis();
smashIndex = (smashIndex+1)%2;
byte color = 4;
if (smashIndex == 1) color = 0;
//UtilText.MakeText("SUPER SMASH MOBS", locOther, faceOther, 159, color, TextAlign.CENTER);
2013-11-16 11:21:04 +01:00
//UtilText.MakeText("SUPER SMASH MOBS", locOther.clone().add(0, 0, -1), faceOther, 159, (byte)15, TextAlign.CENTER);
2013-09-03 02:16:44 +02:00
UtilText.MakeText("SUPER SMASH MOBS", locClassics.clone().add(0, 14, -15), faceOther, 159, color, TextAlign.CENTER);
2013-11-16 11:21:04 +01:00
UtilText.MakeText("SUPER SMASH MOBS", locClassics.clone().add(0, 14, -16), faceOther, 159, (byte)15, TextAlign.CENTER);
UtilText.MakeText("DOMINATE", locComp.clone().add(15, 14, 0), faceComp, 159, color, TextAlign.CENTER);
2013-11-16 11:21:04 +01:00
UtilText.MakeText("DOMINATE", locComp.clone().add(16, 14, 0), faceComp, 159, (byte)15, TextAlign.CENTER);
//System.out.println("TextCreator : " + (System.currentTimeMillis() - startTime) + "ms");
2013-08-27 17:14:08 +02:00
}
*/
2013-08-27 17:14:08 +02:00
}