Merge remote-tracking branch 'origin/clans-beta' into clans-beta

This commit is contained in:
Shaun Bennett 2015-12-04 12:10:10 -05:00
commit f57f4ed0aa
2 changed files with 77 additions and 5 deletions

View File

@ -64,6 +64,7 @@ public abstract class Tutorial implements ScoreboardElement, Listener
public static String SKIPPED_TASK = "tatatatata%sSkip";
public static String AllowedMessage = C.cGold + "TutorialAllowedMessage" + C.Reset;
public static String AllowedBypass = C.cBlue + "Tutorial>";
protected final TutorialManager _manager;
protected final GoldManager _goldManager;
@ -424,6 +425,8 @@ public abstract class Tutorial implements ScoreboardElement, Listener
{
_inTutorial.remove(player.getName());
_manager.finishTutorial(player);
if (_ghostMode)
{
for (Player other : UtilServer.getPlayers())
@ -456,9 +459,7 @@ public abstract class Tutorial implements ScoreboardElement, Listener
public void skip(final Player player)
{
new JsonMessage(
AllowedMessage
)
new JsonMessage("")
.extra(
F.main(
"Tutorial",
@ -472,9 +473,11 @@ public abstract class Tutorial implements ScoreboardElement, Listener
.color("yellow")
.extra("!")
.color("gray")
.sendToPlayer(player);
new JsonMessage(
new JsonMessage("")
.extra(
F.main(
"Tutorial",
"Click "

View File

@ -25,6 +25,7 @@ import mineplex.game.clans.tutorials.commands.DoSkipTutorialCommand;
import mineplex.game.clans.tutorials.commands.SkipTutorialCommand;
import mineplex.game.clans.tutorials.gettingstarted.TutorialGettingStarted;
import net.md_5.bungee.api.ChatColor;
import net.minecraft.server.v1_8_R3.IChatBaseComponent;
import net.minecraft.server.v1_8_R3.PacketPlayOutChat;
public class TutorialManager extends MiniPlugin
@ -64,7 +65,7 @@ public class TutorialManager extends MiniPlugin
{
chat.a.a().remove(0);
}
else
else if (!chat.a.a().get(0).c().contains(Tutorial.AllowedBypass))
{
if (isInTutorial(packet.getPlayer()))
{
@ -184,4 +185,72 @@ public class TutorialManager extends MiniPlugin
{
return _taskManager;
}
// Stolen from UtilTabTitle
private static class TextConverter
{
public static String convert(String text)
{
if (text == null || text.length() == 0)
{
return "\"\"";
}
char c;
int i;
int len = text.length();
StringBuilder sb = new StringBuilder(len + 4);
String t;
sb.append('"');
for (i = 0; i < len; i += 1)
{
c = text.charAt(i);
switch (c)
{
case '\\':
case '"':
sb.append('\\');
sb.append(c);
break;
case '/':
sb.append('\\');
sb.append(c);
break;
case '\b':
sb.append("\\b");
break;
case '\t':
sb.append("\\t");
break;
case '\n':
sb.append("\\n");
break;
case '\f':
sb.append("\\f");
break;
case '\r':
sb.append("\\r");
break;
default:
if (c < ' ')
{
t = "000" + Integer.toHexString(c);
sb.append("\\u").append(t.substring(t.length() - 4));
}
else
{
sb.append(c);
}
}
}
sb.append('"');
return sb.toString();
}
public static String setPlayerName(Player player, String text)
{
return text.replaceAll("(?i)\\{PLAYER\\}", player.getName());
}
}
}