2013-09-18 11:46:45 +02:00
|
|
|
package mineplex.hub.modules;
|
2013-08-27 17:14:08 +02:00
|
|
|
|
2013-08-31 10:19:23 +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;
|
2013-08-31 10:19:23 +02:00
|
|
|
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;
|
2013-08-31 10:19:23 +02:00
|
|
|
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;
|
|
|
|
|
2013-08-31 10:19:23 +02:00
|
|
|
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
|
|
|
{
|
2013-08-31 10:19:23 +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
|
|
|
|
2013-08-31 10:19:23 +02:00
|
|
|
arcadeGames = new String[]
|
|
|
|
{
|
|
|
|
"ONE IN THE QUIVER",
|
2013-09-16 04:23:57 +02:00
|
|
|
"DRAGON ESCAPE",
|
|
|
|
"MILK THE COW",
|
2013-08-31 10:19:23 +02:00
|
|
|
"SUPER SPLEEF",
|
2013-09-16 04:23:57 +02:00
|
|
|
"DEATH TAG",
|
2013-09-18 11:46:45 +02:00
|
|
|
"TURF WARS",
|
2013-08-31 10:19:23 +02:00
|
|
|
"DRAGONS",
|
2013-09-27 21:40:09 +02:00
|
|
|
"RUNNER",
|
|
|
|
"BACON BRAWL",
|
|
|
|
"SQUID SAUCE"
|
2013-08-31 10:19:23 +02:00
|
|
|
};
|
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
CreateText();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void CreateText()
|
|
|
|
{
|
|
|
|
//Comp
|
2013-08-31 10:19:23 +02:00
|
|
|
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
|
|
|
|
2013-08-31 10:19:23 +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
|
2013-08-31 10:19:23 +02:00
|
|
|
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-08-31 10:19:23 +02:00
|
|
|
|
2013-11-30 12:11:26 +01:00
|
|
|
UtilText.MakeText("DRAW MY THING", locClassics.clone().add(0, 21, -15), faceOther, 159, (byte)1, TextAlign.CENTER);
|
|
|
|
UtilText.MakeText("DRAW MY THING", locClassics.clone().add(0, 21, -16), faceOther, 159, (byte)15, TextAlign.CENTER);
|
2013-11-16 11:21:04 +01:00
|
|
|
|
2013-11-30 12:11:26 +01:00
|
|
|
UtilText.MakeText("BLOCK HUNT", locClassics.clone().add(0, 28, -15), faceOther, 159, (byte)14, TextAlign.CENTER);
|
|
|
|
UtilText.MakeText("BLOCK HUNT", locClassics.clone().add(0, 28, -16), faceOther, 159, (byte)15, TextAlign.CENTER);
|
2013-08-31 10:19:23 +02:00
|
|
|
}
|
|
|
|
|
2013-12-24 06:39:33 +01:00
|
|
|
/*
|
2013-08-31 10:19:23 +02:00
|
|
|
@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);
|
2013-08-31 10:19:23 +02:00
|
|
|
|
|
|
|
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);
|
2013-08-31 10:19:23 +02:00
|
|
|
|
|
|
|
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);
|
2013-08-31 10:19:23 +02:00
|
|
|
|
|
|
|
arcadeIndex = (arcadeIndex + 3)%arcadeGames.length;
|
|
|
|
}
|
2013-12-24 06:39:33 +01:00
|
|
|
*/
|
2013-08-31 10:19:23 +02:00
|
|
|
|
|
|
|
public String GetArcadeText(int offset)
|
|
|
|
{
|
|
|
|
int index = (arcadeIndex + offset)%arcadeGames.length;
|
|
|
|
|
|
|
|
return arcadeGames[index];
|
|
|
|
}
|
|
|
|
|
2013-09-05 03:52:08 +02:00
|
|
|
/*
|
2013-08-31 10:19:23 +02:00
|
|
|
@EventHandler
|
|
|
|
public void UpdateNew(UpdateEvent event)
|
|
|
|
{
|
|
|
|
if (event.getType() != UpdateType.FAST)
|
|
|
|
return;
|
|
|
|
|
2013-09-05 03:52:08 +02:00
|
|
|
long startTime = System.currentTimeMillis();
|
|
|
|
|
2013-08-31 10:19:23 +02:00
|
|
|
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-08-31 10:19:23 +02:00
|
|
|
|
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);
|
2013-08-31 10:19:23 +02:00
|
|
|
|
|
|
|
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);
|
2013-09-05 03:52:08 +02:00
|
|
|
//System.out.println("TextCreator : " + (System.currentTimeMillis() - startTime) + "ms");
|
2013-08-27 17:14:08 +02:00
|
|
|
}
|
2013-09-05 03:52:08 +02:00
|
|
|
*/
|
2013-08-27 17:14:08 +02:00
|
|
|
}
|